Concept, Concept Map, and Axioms
So, I'm going over the C++0x draft, and I get to concepts. I'm understanding it up to where it starts getting into concept maps.
What is the purpose exactly of a concept map as opposed to a concept?
When 'typedef' and 'typename' are used in concepts and concept maps, what do they mean?
When would you use a type other than 'auto' for a concept?
What is an axiom? (this part was totally confusing to me)
Re: Concept, Concept Map, and Axioms
Axioms are basically ways of telling the compiler explicitly that certain transformations are valid on a given class of expression. This might in theory allow it to make better optimization decisions. For the most part it's not likely to be something programmers worry about directly.
For instance, if a given class should have commutative multiplication properties, you could specify an axiom that A * B == B * A.
Re: Concept, Concept Map, and Axioms
Quote:
Originally Posted by
Lindley
Axioms are basically ways of telling the compiler explicitly that certain transformations are valid on a given class of expression. This might in theory allow it to make better optimization decisions. For the most part it's not likely to be something programmers worry about directly.
For instance, if a given class should have commutative multiplication properties, you could specify an axiom that A * B == B * A.
Is this restricting in that this must be true for a type in order to be used in the template, or is it the developer's responsibility to make sure it's true in all cases?
Re: Concept, Concept Map, and Axioms
For example, if I were to define an axiom as follows:
Code:
axiom Associativity(Op op, T x, T y, T z)
{
op(x, op(y, z)) == op(op(x, y), z);
}
Will the compiler actually confirm that this is true and enforce it, or is it trusted that, since I defined it, it must be true in all cases for that concept, just because I said so?
Re: Concept, Concept Map, and Axioms