Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] invalid initialization of non-const type with adaptors
From: Neil Groves (neil_at_[hidden])
Date: 2010-05-11 07:33:11


>
> Also note that in a world with perfect forwarding, we shuold
>> probably specify fill() like
>>
>> template< class Rng >
>> void fill( Rng&& rng, range_value<Rng>::type x );
>>
>>
>> Wouldn't this stop fill from working on ranges of abstract types?
>>
>
> I don't know. Usually when deal with abstract types, I don't use fill()
> for anything because those types are not copyable or assignable.
>
>
> -Thorsten
>

I have infrequently have abstract types that are assignable. I don't think
this alters your key point about the forwarding but I think we should
probably have this instead:

template< class Range, class Value >
void fill( Rng&& rng, const Value& x );

Where 'Value' is required to be convertible to one of the right-hand side
arguments of an assignment to a range_value<Rng>::type.

Does this look sensible to you?

Regards,
Neil Groves



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net