( Preamble: I am a late follower of C ++ 0x, and recent debate about removing concepts from the C ++ 0x standard has prompted me to learn more about them. Although I understand that all my questions are completely hypothetical - since the concepts will not be valid C ++ -code for some time, if at all - I'm still interested in learning more about the concepts, especially considering how this will help, I understand in more detail the advantages of the recent solution and the contradictions that followed)
After reading some introductory materials on concepts, as C ++ 0x suggested them (until recently), I have problems with some syntax problems. Without further ado, here are my questions:
1) Will a type that supports a particular derived concept (either implicitly, via the auto keyword, or explicitly through concept_maps) also have to support the underlying concept unchanged? In other words, is it meant to get a concept from another (for example, concept B<typename T> : A<T> ) to include an "invisible" request (inside B, requires A<T>; )? Confusion arises on the Wikipedia page on concepts, which reads:
As with class inheritance, types that meet the requirements of a concept also meet the requirements of a basic concept.
It seems that the type should satisfy only derived conceptual requirements and optionally basic conceptual requirements, which makes no sense to me. I understand that Wikipedia is far from the final source; Is the above description just a bad choice of words?
2) Can a concept that lists type names be "auto"? If so, how does the compiler automatically match these types of names? If not, are there other cases where it would be wrong to use the βautoβ in the concept?
To clarify, consider the following hypothetical code:
template<typename Type> class Dummy {}; class Dummy2 { public: typedef int Type; }; auto concept SomeType<typename T> { typename Type; } template<typename T> requires SomeType<T> void function(T t) {} int main() { function(Dummy<int>());
Will any of these classes match SomeType? Or is the concept concept_map necessary for concepts with type names?
3) Finally, I can hardly understand which axioms can be defined. For example, is it possible to define a concept of an axiom that is logically incompatible, for example
concept SomeConcept<typename T> { T operator*(T&, int); axiom Inconsistency(T a) { a * 1 == a * 2; } }
What would it do? Is this even true?
I appreciate that this is a very long set of questions, and therefore I thank you in advance.