|
Boost : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-05-08 17:35:18
Eric Niebler wrote:
> David Abrahams wrote:
>>> Your patch gets everything all mixed up.
>>
>>
>>
>> That's rather a bald and sweeping statement to make without any
>> explanation. What do you really mean by "everything" in this case?
>
>
>
>
> Everything, in this case, means the separate and orthogonal
responsibilities of the three range metafunctions.
>
> This is a potentially breaking change. Consider a range adaptor...
>
> template<typename Range> struct some_adaptor
> {
> typedef typename range_iterator<Range>::type iterator;
> typedef typename range_const_iterator<Range>::type const_iterator;
> ....
> };
>
> In this case, you really don't care about the const-ness of Range --
you just want the nested ::iterator type. And anyplace someone is using
these metafunctions to perform type computations where const-ness
doesn't matter will now be broken.
In the new version, this is how range_iterator is defined:
namespace boost
{
template< typename C >
struct range_iterator
{
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
BOOST_DEDUCED_TYPENAME range_const_iterator<
BOOST_DEDUCED_TYPENAME remove_const<C>::type
>::type,
BOOST_DEDUCED_TYPENAME
range_mutable_iterator<C>::type >::
type type;
};
} // namespace boost
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk