the obvious thing you're missing is that a "Concept" is just a glorified name
for some static asserts.
So you can get what you want by using
template
struct my_class {
static_assert(std::is_same::value, "Types differ!");
....
};
template
int x(T &t; U& u){
static_assert(std::is_same::value, "Types differ!");
... code here
}
If you want to make an "official looking" concept you can
look at boost concept library which describes how to do this. The
short version is
template
struct MyConcept {
static_assert(std::is_same::value, "Types differ!");
... all the other type requirements
};
Then you could change my class to look like
template
struct my_class : public MyConcept {
....
};
template
int x(T &t; U& u){
typedef MyConcept concept_check;
... code here
}
Take a look at the Boost concept library which explains all this better.
Robert Ramey
--
View this message in context: http://boost.2283326.n4.nabble.com/ConceptCheck-Same-type-concept-tp4666862p...
Sent from the Boost - Users mailing list archive at Nabble.com.