is_range / is_range_of metafunctions

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

On Thu, Jun 24, 2010 at 7:12 PM, Duncan Smith
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.
Did I overlook something? Is there an easy way to get this effect?
You may not have overlooked anything, but normally using Boost.ConceptCheck with the appropriate RangeConcept achieves a solution to most problems, but admittedly does not provide a solution to disambiguate overloads in enable_if expressions.
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?
This contribution has only been received recently and before it can become part of Boost.Range I need to ensure correctness and portability across compilers. It also needs tests and documentation to meet the completeness expected of a high quality Boost library. I have also been very busy! I am very excited about this contribution, and if all goes smoothly then it will be in the next Boost release. Thanks for any guidance,
Duncan
You can help by trying out the code on the list and informing me of the compiler and platform you are using ;-) Thanks, Neil Groves

On 24 June 2010 17:21, Neil Groves
This contribution has only been received recently and before it can become part of Boost.Range I need to ensure correctness and portability across compilers. It also needs tests and documentation to meet the completeness expected of a high quality Boost library. I have also been very busy!
That makes sense. (Thanks the library... I think it's great.)
I am very excited about this contribution, and if all goes smoothly then it will be in the next Boost release.
Great! I'll use it locally until then.
You can help by trying out the code on the list and informing me of the compiler and platform you are using ;-)
It works for me on Gentoo Linux (kernel 2.6.31-gentoo-r6). Here is the output of gcc --version: gcc (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Duncan
participants (2)
-
Duncan Smith
-
Neil Groves