
I'm using the Boost.Range 2.0 library (Boost version 1.43.0), and I
was looking for metafunctions to use in conjunction with
boost::enable_if. I wasn't able to find anything akin to "is_range"
and/or "is_range_of" in Boost.Range or in Boost.TypeTraits.
Here is a demonstrative example that uses "is_range_of":
class Y, Z;
class X
{
struct enabler {};
public:
// Construct from a range of Y.
template <class Range>
X(const Range &r,
typename boost::enable_if
< typename boost::is_range_of
::type = enabler()) { /* ... */ }
// Construct from a range of Z.
template <class Range>
X(const Range &r,
typename boost::enable_if
< typename boost::is_range_of
::type = enabler()) { /* ... */ } };
Did I overlook something? Is there an easy way to get this effect? I did find an email in the archives with an implementation of this functionality: http://lists.boost.org/Archives/boost/2007/08/125851.php That implementation works for me. Is there a reason they have not been included? Thanks for any guidance, Duncan