Adding range-v3 dependencies ?

For code related discussions and questions
Post Reply
Vincent
Trained
Trained
Posts: 103
Joined: 06 Aug 2016, 17:24

Adding range-v3 dependencies ?

Post by Vincent » 09 Sep 2017, 18:17

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 ?

pastdue
Code contributor
Code contributor
Posts: 128
Joined: 13 Aug 2017, 17:44

Re: Adding range-v3 dependencies ?

Post by pastdue » 11 Sep 2017, 03:07

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:
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.
(Emphasis mine.)

Also, Range-v3 seems to be considerably slower than the standard algorithms, even on aggressively-optimized release builds.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3755
Joined: 03 Aug 2006, 19:39

Re: Adding range-v3 dependencies ?

Post by Per » 11 Sep 2017, 18:23

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.

Post Reply