|
Boost : |
Subject: Re: [boost] [concept] EqualityComparable metafunction
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-09-05 20:32:59
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk