From the documentation of ranges-v3:
view::all
Return a range containing all the elements in the source. Useful for converting containers to ranges.
What makes me confused are:
- Under what scenarios are
view::all
used? - Are standard containers (
std::vector
,std::list
, etc.) not ranges conceptually?
For example:
auto coll = std::vector{ 1, 2, 2, 3 };
view::all(coll) | view::unique; // version 1
coll | view::unique; // version 2
Is there any difference between version 1
and version 2
?