$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2006-01-06 12:48:33
MB wrote:
> Hi,
> 
> I think non-intrusive customization way needs four specializations;
> 'X', 'const X', 'volatile X' and 'const volatile X'.
> At last, twenty specializations are required for five metafunctions.
> I view that's something like the pitfall of public virtual interfaces.
if that is true, then it is certainly bad.
> Only range_result_iterator happens to work around by using remove_cv.
> 
> See:
> 
>   I added followings to <libs/range/doc/example.cpp>:
> 
>     template< class Range >
>     typename boost::range_result_iterator<Range>::type
>     my_begin(Range& rng)
>     {
>       return boost::begin(rng);
>     }
> 
>       // then...
>       my_begin(cpair); // error
right, because we instantiate range_const_iterator< const T >, which 
should never happen.
>   Why not something like:
> 
>     template< class T >
>     struct range_result_iterator :
>       mpl::eval_if< is_const<T>,
>         range_const_iterator< typename remove_cv<T>::type >,
>         range_iterator< typename remove_cv<T>::type >
>       >
>     { };
Seems right to me.
I the latest release I actually added similar stuff to begin(),end() to 
remove const qualifiers from "const T", since it lead to such "const T" 
being used to instatiate metafunctions *even though* the overload was 
never picked.
So this means that begin()/end() must also remove volatile. Cute :-)
Thanks for the feedback
-Thorsten