|
Boost : |
From: Douglas Gregor (dgregor_at_[hidden])
Date: 2008-03-31 10:29:27
On Mon, 2008-03-31 at 15:22 +0100, Giovanni Piero Deretta wrote:
> but in general it might reopen the problem of deferred typechecking of
> template parameters.
> Are constrained template template parameters legal?
Yes.
> i.e.:
>
> // Takes a constrained template:
> template<template<Value> class S> // is this syntax even legal?
> struct foo {};
>
> // A constrained template
> template<Regular Value>
> struct vector
> {};
>
> foo<vector> f; // OK?
Yes, this is fine, assuming that the template template parameter S was
meant to be written as:
template<Regular> class S
You could also have more constraints on the template argument, e.g.,
template<Regular Value> requires LessThanComparable<Value>
struct set;
foo<set> f2; // okay
> [ If it is not legal, I guess you could fake it with concept achetypes
> and some kind of rebind trick.]
Ick.
> Not useful for metaprogramming, but for more mundane things, you might
> not want to lose the benefits of
> concept typechecking.
It might be useful for metaprogramming; I don't actually know. Some
metaprogramming is likely to change when using concepts, but we're doing
our best not to hurt metaprogramming in the process of adding concepts.
- Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk