
6 Sep
2011
6 Sep
'11
12:32 a.m.
on Mon Sep 05 2011, Lorenzo Caminiti <lorcaminiti-AT-gmail.com> wrote:
Hello all,
What is the best way to check if a type T is EqualityComparable?
Essentially, I would need a is_equality_comparable<> metafunction:
struct mytype {};
is_equality_comparable<int>::value // true is_equality_comparable<mytype>::value // false
Can I re-use the boost::EqualityComparable concept
No, that won't get you what you want: concepts eagerly generate hard errors when not satisfied. I think we've had at least one proposal of a library to support this, but if no off-the-shelf solution presents itself, you could copy the pattern given by boost/detail/is_incrementable.hpp -- Dave Abrahams BoostPro Computing http://www.boostpro.com