In the context of generic programming, the term
concept is used to describe the collection of requirements that a template argument must meet for the function or class template to compile and operate properly.
The requirements for a concept consist of a set of valid expressions, associated types, invariants and complexity guarantees. A type
models a concept if it meets the set of requirements. A concept can also extend the requirements of another concept, which is called
refinement.
These are quotations from
TheBoostGraphLibrary p.27-28
The problem being addressed is the one described in
GenericVsObjectOrientedProgramming. What can happen in practice with programming using C++ templates is that a wrong choice of object type gives rise to extremely long compile time error messages which are difficult to understand. The requirements can be programmed in such a way as to get cleared compile time error messages which locate the origin of the problem.
There is program code for this in the The Boost Concept Check Library (BCCL) which is one of the
BoostLibraries and is documented at
http://www.boost.org/libs/concept_check/concept_check.htm
JohnFletcher
See also
ConceptCpp and
ConceptGcc.
CategoryCpp CategoryCppTemplates