|
Boost : |
From: MB (mb2act_at_[hidden])
Date: 2006-01-05 08:07:11
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.
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
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 >
>
{ };
Regards,
MB
p-stade.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk