Range-v3 is a header only libraries that adds range types to C++.
A range is a structure that holds a begin and end iterator from a collection like std::vector or list.
The benefit of using ranges over iterator is that you can compose ranges and thus refactor code much more easier and improve readability.
Since range-v3 only has a view on iterator, every range operation modifies iterator instead of creating a new collection (it's what is referred as "lazy range combinator", using metaprogramming iterator operation are collapsed into a single iterator type) which means it doesn't add overhead.
It's often referred as "STL 2.0" given it could completly change how container are used in C++.
So far it's supported by every C++14 compiler out there (including MSVC) and will be part of ISO C++2020.
Some example can be found here https://ericniebler.github.io/range-v3/ ... uick-start
Is it ok to add it to warzone 2100 ?
Adding range-v3 dependencies ?
Re: Adding range-v3 dependencies ?
Warzone is still using C++11. I'm not sure what the current minimum supported compilers are, or if those match Range-v3's requirements.
I'm a bit more concerned about the gigantic caveat in Range-v3's documentation:
Also, Range-v3 seems to be considerably slower than the standard algorithms, even on aggressively-optimized release builds.
I'm a bit more concerned about the gigantic caveat in Range-v3's documentation:
(Emphasis mine.)This code is fairly stable, well-tested, and suitable for casual use, although currently lacking documentation. No promise is made about support or long-term stability. This code will evolve without regard to backwards compatibility.
Also, Range-v3 seems to be considerably slower than the standard algorithms, even on aggressively-optimized release builds.
Re: Adding range-v3 dependencies ?
I'm not sure if I see a big benefit, to be honest. And if we start using such libraries, then we add to the number of bits and pieces that people have to learn in order to get into the codebase and start coding.