$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [Range] sorted and randomized adaptors
From: Jeff Flinn (jeffrey.flinn_at_[hidden])
Date: 2015-11-09 22:14:48
On 10/31/15 7:33 PM, 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. I want to know however if having such
> adaptors may contradict any basic principles of the existing adaptors.
>
> P.S. Two other threads I found that discussed the same idea(for sorted only):
> - http://listarchives.boost.org/Archives/boost/2009/03/149247.php
> - http://listarchives.boost.org/Archives/boost/2006/05/105122.php
Check out http://ericniebler.com for related discussions and his range
v3 library, which provide non lazy adaptors for the above.
Jeff