[ConceptGCC] |
ConceptGCC :Re: Associated class templates |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-05-03 15:31:51
On May 1, 2007, at 4:46 PM, Marcin Zalewski wrote:
> The "Proposed wording for concepts"
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2193.pdf)
> gives an example (page 22):
>
> concept Allocator<typename Alloc>
> {
> template<class T>
> struct rebind;
> };
>
> Yet, conceptGCC gives an error for such concept:
>
> template<class Alloc> template<class T> struct
> Allocator<Alloc>::rebind
> is not permitted in a concept
>
> I am wondering what is the current thinking about associated class
> templates. That aspect of concepts seems to be covered very
> scarcely in
> the concept proposal even though it is allowed by the grammar
> specification. Is it underspecified because concepts designers are not
> sure how to handle associated class templates?
It's underspecified because we don't have the implementation
experience to specify it well, yet.
> And a related question,
> will associated class templates be included in concept proposals in
> the
> future or is it a feature that may likely get dropped?
It will be included. I expect that as we work through the formal
specification, we'll tighten up the semantics. I hope we'll be able
to implement it in the same time-frame... we'll see. We could
certainly use help in crafting precisely how associated templates
should work.
> The question is related to my previous post about a Monad concept. If
> associated class templates would be allowed then concepts could
> provide
> type computations. As for now type computations (such as rebind)
> seem to
> be impossible without associated class templates.
Right. Associated templates are crucial for metaprogramming in the
concepts world.
- Doug