Boost logo

Boost :

Subject: Re: [boost] [Range] sorted and randomized adaptors
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2015-11-02 08:33:35


On 01-11-2015 00:33, Mohammed El-Afifi wrote:
> Hello everybody,
>
> I know this might have been raised a few times before in this mailing list,
> but I'd like to know if it's possible(or otherwise what would prevent) to
> have sorted and randomized adaptors so that I may have a sorted and
> randomized view of a range respectively. Something like
>
> vector<int> x;
> // operations to fill x
> x | boost::adaptors::sorted;
> x | boost::adaptors::randomized;// That one might also take an optional
> random generator as a parameter.
>
> I understand that in this case the adaptor isn't entirely lazy as the
> adapted(x here) must be completely consumed before producing a single
> element in the resulting range.

Right.

> I want to know however if having such
> adaptors may contradict any basic principles of the existing adaptors.

Well, you could say being lazy is the principle being violated.

-Thorsten


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