Boost logo

Boost :

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2008-03-31 09:25:22


On Mon, 2008-03-31 at 00:09 -0700, Eric Niebler wrote:
> Giovanni Piero Deretta wrote:
> > On Fri, Mar 28, 2008 at 9:56 PM, Eric Niebler <eric_at_[hidden]> wrote:
> > What about
> >
> > template<class Wrapped<typename T...>, typename ArgList... >
> > class bind;
> >
> > bind<vector, foo(bar(_1)), _2>
> >
> > That should work, even if 'Wrapped' requires it template arguments to
> > conform to some exotic concept.
>
> Really? It seems to me that this would effectively strip the
> requirements from a template, violating the metatype system. Can someone
> who knows, comment?

This won't be the case... it doesn't actually strip the requirements
from the template, it just defines an unconstrained template and delays
the construction of the vector<> until we have something that should
meet vector's requirements.

> > Or may be something like this:
> >
> > bind<vector>(foo(bar(_1)), _2)
> >
> > Untested of course, and I'm not sure how concepts interact with
> > template template parameters.
>
> Me neither. Doug? The question is whether this should compile in C++0x:
>
> // Takes an unconstrained template:
> template<template<typename T> class S>
> struct foo
> {};
>
> // A constrained template
> template<Regular Value>
> struct vector
> {};
>
> foo<vector> f; // OK? Prolly not.

Yes, this is well-formed C++0x. We (have to) let unconstrained template template parameters bind to constrained templates.

  - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk