Concepts is a general programming function that allows a person writing template code to specify requirements that type parameters must meet.
For example, some collection types need a type parameter for the collection to define & lt; operator. Thus, the programmer can define a concept called LessThanComparable, which tells the compiler that the type parameter for the template class must have the & lt; defined. If the template user then tries to instantiate the template using a type that does not have the LessThanComparable concept (that is, does not have the & lt; operator function), the compiler can produce a simple error message rather than a stream of error messages related to the template code. The compiler can also use the additional information provided by the concepts to generate more efficient code.
This is too simplistic, but I think it gives you a general idea of ββthe concepts.
If you want to try out some of the features of the concepts, take a look at the Boost.Concept Check library. I do not think that it provides the whole range of features that should have been in the standard, but this is a good place to start.
You can also look at ConceptC ++ , there is a good definition of concepts.
Ferruccio Aug 10 '09 at 2:03 2009-08-10 02:03
source share