Boost logo

Boost :

Subject: [boost] [Range] sorted and randomized adaptors
From: Mohammed El-Afifi (Mohammed_ElAfifi_at_[hidden])
Date: 2015-10-31 19:33:44


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://lists.boost.org/Archives/boost/2009/03/149247.php
- http://lists.boost.org/Archives/boost/2006/05/105122.php


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