Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-01-10 23:27:00


Eric Niebler wrote:
> Thorsten Ottosen wrote:
>> Eric Niebler wrote:
>>> Consider the output of the following program:
>>>
>> >
>>> It seems Boost.Range is still treating arrays of char and wchar_t
>>> specially. IIRC, we decided long ago that it shouldn't.
>>>
>>> This is on HEAD, BTW.
>> Fixed
>
> Thanks. You might want to add a test for this as well <nudge>.
>
> While we're at it, this trivial code fails to compile on msvc-7.1:
>
> int rg[5] = {};
> boost::begin(rg);
>
> Clearly, it's a compiler bug. But the work-around is simple enough. In
> range/begin.hpp, the begin() overloads have the following signatures:
>
> template< class T >
> typename range_iterator<T>::type begin( T& r )
>
> template< class T >
> typename range_iterator<const T>::type begin( const T& r )
>
> If there were defined as follows:
>
> template< class T >
> typename range_mutable_iterator<T>::type begin( T& r )
>
> template< class T >
> typename range_const_iterator<T>::type begin( const T& r )

Another(more generic?) workaround seems known.

template< class T >
typename range_iterator< typename add_const<T>::type >::type
some_algo(T const& rng) {
     // ...
}

I prefer a macro to document this bug... http://tinyurl.com/y2wkq3
Well, this bug seems not only involved in Boost.Range.
VC++7.1 users would need this workaround; everywhere 'T' is deduced as
array type.

Regards,

-- 
Shunsuke Sogame

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk