Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-05-30 13:32:06


Neal Becker wrote:
> Thorsten Ottosen wrote:
>
>
>>Neal Becker wrote:
>>
>>>#include <boost/range.hpp>
>>>#include <vector>
>>>
>>>template<typename in_t, typename out_t>
>>>void copy (in_t const& in, out_t &out) {}
>>
>>What makes you think you can bind a temporary to
>>an non-const reference (out)?
>>
>
>
> Yeah, same old problem. I think the c+ standard should be changed.

Well, && will help some.

> It's
> quite clear (to me) that this is an important use of the range concept.

I think the algorothm is wrong in this case. I would go for

template< class SinglePassRange, class WritableForwardRange >
void overwrite( const SinglePassRange&, WriteForwardRange& );

template< class SinglePassRange, class WritableForwardRange >
void overwrite( const SinglePassRange&, const WriteForwardRange& );

(which in C++0x can become one function using &&).

-Thorsten


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