
On Mon, Mar 31, 2008 at 2:25 PM, Douglas Gregor <dgregor@osl.iu.edu> wrote:
On Mon, 2008-03-31 at 00:09 -0700, Eric Niebler wrote:
[...] 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.
This is good news for metaprogramming but in general it might reopen the problem of deferred typechecking of template parameters. Are constrained template template parameters legal? 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? [ If it is not legal, I guess you could fake it with concept achetypes and some kind of rebind trick.] Not useful for metaprogramming, but for more mundane things, you might not want to lose the benefits of concept typechecking. -- gpd