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-10 10:35:49


On Mon, May 10, 2010 at 2:24 PM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:

> Neil Groves wrote:
>
> This can't easily be remedied since the Range Concept is non-copyable, and
>> we obviously can't pass a const reference as the target to the fill
>> algorithm. Making the Range Concept cheaply copyable would mean that the
>> standard containers were no longer a model of the Range Concepts. I am
>> currently investigating extending the sub_range
>>
>
> It should be perfectly ok to make iterator_range and sub_range cheaply
> copyable, since they just wrap iterators.
> No need to extend the range concepts for that; iterator_range would simply
> provide more than those concepts.
>
>
The rationale for providing new concepts that extend the sub_range is that
we can then implement new containers and new algorithms in terms of concepts
similar to those that Alexandrescu describes.

As you have suggested this is actually a very simple extension to sub-range
and allows efficient interoperability between iterator ranges and
Alexandrescu style ranges. I'm finding this to be very nice when
implementing ranges that do not map well to iterators, such as an unbounded
integer range.

I'm in the very early stages of exploring these ideas.

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