Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Concepts for Template Template Parameters

From: Daniel Lincke (daniel.lincke_at_[hidden])
Date: 2007-09-24 05:48:18


Hi ConceptGCC-users,

I'm playing a little bit around and asking myself if one could define
concepts for template template parameters (which might be a useful
feature in some cases) ... the following "empty" example compiles
without errors:

#ifdef __GXX_CONCEPTS__
concept Container_Concept<template <class> class C> {
// typename size_type;
// size_type size();
};
#endif

template<class T>
class Container_Example {
// typedef int size_type;
// size_type size() {return 0;}
};

#ifdef __GXX_CONCEPTS__
concept_map Container_Concept<Container_Example> {
};
#endif

template<template <class> class C, class T>
#ifdef __GXX_CONCEPTS__
  requires Container_Concept<C>
#endif
void test (C<T> container) {
}

So it seems to be possible. However I havn't found out how to use
concept_map in this case ... assuming we would uncomment the typedef and
the size() function in Container_Concept and Container_Example, how
would one map them to each other via concept_map?

Greets and Thanks!
Daniel