Hi,
I've just recently started using boost::concept_check. It suits my needs
very well and works perfectly so far. However, today I've come across
something that is missing: The ConceptConcept! What I mean is a meta
concept that checks whether a given template is a concept checking class.
It should be relatively straightforward to implement, here is some example
code I've cooked up:
#include
template
struct ConceptConcept
{
/* Instead of int, any type allowed as template parameter should do. */
_TConcept<int> c;
void constraints()
{
/* Require the constraints() function to exist in _TConcept. */
c.constraints();
}
};
template
void function()
{
boost::function_requires< ConceptConcept<T> >();
}
template<typename T>
struct NoConcept
{
};
int main(void)
{
functionboost::IntegerConcept();
//function<NoConcept>(); // <- fails, NoConcept::constraints() is missing.
}
Note that due to the template template technique, this only works for
ConceptConcept. Higher meta levels (e.g. ConceptConceptConcept) are not
supported by this code.
I'd like to see this in boost::concept_check. What do you think?
Cheers,
- Mattias