Library / SDK
ericniebler/range-v3 avatar
ericniebler/range-v3

range-v3 builds ranges as a layer over iterators, not a replacement

Range library for C++14/17/20, basis for C++20's std::ranges

4,377 stars471 forksC++NOASSERTION

At a glance

What is it?
range-v3 wraps STL iterators in a range abstraction built from views, actions and pipe syntax. Whether that buys you anything over C++20 ranges, and what a stale package index costs you, is what an adopter has to weigh.
Who is it for?
Adopt range-v3 if your compiler is clang 6 or newer or GCC 7 or newer and you want the pipe syntax and view composition now, and pin a specific commit rather than tracking master. Do not adopt it if your build must stay on Visual Studio without /permissive- plus /std:c++20 or /std:c++17, or if you need a stable API contract, because the README states the code will evolve without regard for backwards compatibility.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 36 days ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • ericniebler/range-v34,377 ★ · +1
Star history
Repository2026-09-232026-11-15
ericniebler/range-v34.4k4.4k

1 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Ranges sit on top of iterators rather than replacing them

Most range proposals start by removing iterators. range-v3 does the opposite, and that single decision explains the shape of the whole library. A range here is an abstraction layer over an existing pair of iterators, so every STL algorithm that already takes a begin and an end keeps working, and range-v3 adds range overloads beside them instead of in place of them. For a reader deciding between a container wrapper library and this one, that matters: adopting range-v3 does not mean rewriting algorithms that already consume iterators.

The lineage is documented plainly. The repository states that this code was the basis of a formal proposal to add range support to the C++ standard library, that the proposal went through a Technical Specification, and that it ended as P0896R4 "The One Ranges Proposal", merged into the C++20 working drafts in November 2018. The library is therefore a working prototype of a feature that later shipped in a compiler, which cuts both ways. It explains the design and it limits who needs it: if your toolchain already has std::ranges, the reason to vendor this library is views and actions that C++20 does not cover, not the range concept itself.

Three pillars: views stay lazy, actions mutate in place

range-v3 splits its surface into views, actions and algorithms, and the split is about eagerness. A view is a composable adaptation of a range where the adaptation happens lazily while the view is iterated, so nothing is copied and nothing is materialised until you consume the result. An action is the eager opposite: it applies an algorithm to a container, mutates that container in place, and returns it so the next stage can keep working on it. Algorithms themselves are the familiar STL set, with range overloads added alongside the iterator overloads.

Both views and actions compose with the pipe operator, so a pipeline reads left to right as rng | adapt1 | adapt2. That syntax is the ergonomic argument for the library. The catch is that laziness cuts both ways. A view defers work, which means an error in a later adaptation stage surfaces at the point of iteration rather than at the point of construction, and the eager action you reach for to make things predictable returns the container rather than a new value. Choosing between the two is a daily decision inside a single file, not a one-off architectural choice.

Installing through vcpkg clones the package manager itself

The README documents several install routes, starting with vcpkg. It requires cloning and bootstrapping the dependency manager before range-v3 itself is fetched:

sh
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install range-v3

The README notes that the port is maintained by Microsoft team members and community contributors, and that if the version lags you should open an issue or pull request against the vcpkg repository rather than patching range-v3 itself.

The Conan route is different in kind. You write a `conanfile.txt` declaring the requirement, then point CMake at the generated toolchain file:

code
[requires]
range-v3/[*]

[generators]
CMakeDeps
CMakeToolchain
sh
$ conan install . --build=missing --output-folder=build
$ cmake . -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
$ cmake --build build

Your `CMakeLists.txt` then links the imported target:

cmake
project(myproject CXX)

add_executable(${PROJECT_NAME} main.cpp)
find_package(range-v3 REQUIRED)
target_link_libraries(${PROJECT_NAME} range-v3::range-v3)

A `build2` route is also described. Both package managers delegate version freshness to their own maintainers, so what you install is whatever their index says, not whatever the range-v3 repository says.

No tag since 0.12.0, while master keeps moving

Two facts on the repository page do not agree with each other. The repository is not archived and the last push to master was on 2026-10-10, yet the newest listed tag is 0.12.0 from 2022-06-21, followed by 0.11.0 from 2020-08-06 and 0.10.0 from 2019-12-07. The newest label in that version list is not what the branch holds. Everything after that point lives on master only, or on whatever a package manager port happened to pin.

That gap is the operational cost of this library. Pinning a commit is the only way to get a reproducible build from the repository itself, and a vcpkg or Conan install inherits the risk of that port being stale or, in the other direction, tracking a moving branch. The author is explicit about the API contract: the code is described as fairly stable and suitable for casual use but lacking documentation, no promise is made about support or long-term stability, and it will evolve without regard for backwards compatibility. The stated exception is anything inside `ranges::cpp20`, which is intended to change rarely or never.

Visual Studio needs /permissive- and a language mode flag

The compiler matrix is short and the Windows entries carry conditions. range-v3 is known to work on clang 6 or later, on GCC 7 or later, and on Clang/LLVM 6 or later on Windows, with the README noting that older versions may work but have not been tested. Visual Studio 2019 or later is listed with caveats that follow directly from range-v3's strict conformance requirements.

Those caveats are a specific pair of flags. MSVC needs `/permissive-` and one of `/std:c++latest`, `/std:c++20` or `/std:c++17`.

Documentation the project itself calls incomplete

The README links a hosted documentation set and labels it "woefully incomplete" in the same line. Everything else the project points at is dated: a CppCon talk from 2015, blog posts from 2013 and 2014 on actions and range comprehensions, design papers from the WG21 era, and proxy iterator write-ups from 2015. The README itself warns the reader to mind the dates.

So the practical source of truth is the repository tree, not prose. Top level holds `include/`, `example/`, `test/`, `perf/`, `doc/` and `cmake/`, plus `CMakeLists.txt`, `conanfile.py`, `Version.cmake`, `BUILD.bazel`, `WORKSPACE`, `MODULE.bazel` and `BUCK`, which is to say the build is described four different ways for four different toolchains. Under `example/` sit small single-purpose programs such as `hello.cpp`, `filter_transform.cpp`, `sort_unique.cpp`, `comprehensions.cpp` and a `view/` directory. Those files, not the documentation site, are where a new user should read the library's argument. The `test/` directory is the other honest reference for behaviour the README does not cover.

Where Boost.Range and C++20 ranges differ in approach

Boost.Range is the older answer to a similar problem and takes a different route. It works by adapting iterators into range adaptors through wrapper types, and it extends an existing iterator-centric standard library in place, which is closer to range-v3's position than the newer proposals that discard iterators entirely. It is also a mature Boost library with its own version cadence, so a team that already ships Boost and wants a modest composability gain has a lower-friction option.

C++20 ranges in the standard library are the third choice, and the one that removes the dependency altogether. Where range-v3 offers actions, which mutate a container in place and hand it back, and a view library far wider than the standard set, the standard gives you range overloads on the existing algorithms and the views that shipped. A team targeting a single modern compiler should read the standard first and reach for range-v3 only for the pieces C++20 did not take, including the actions.

Editorial conclusion

Adopt range-v3 if your compiler is clang 6 or newer or GCC 7 or newer and you want the pipe syntax and view composition now, and pin a specific commit rather than tracking master. Do not adopt it if your build must stay on Visual Studio without /permissive- plus /std:c++20 or /std:c++17, or if you need a stable API contract, because the README states the code will evolve without regard for backwards compatibility. Check first which commit your package manager actually resolves, then read the namespace you depend on: anything under ranges::cpp20 is the part the author promises to change least.

Frequently asked questions

Is range-v3 the same as std::ranges in C++20?

The README states that range-v3 was the basis of the proposal that became P0896R4, merged into the C++20 working drafts in November 2018. range-v3 goes further in some directions, adding eager actions that mutate a container and return it, which the standard does not have.

How do you install range-v3 with vcpkg?

Clone vcpkg, run ./bootstrap-vcpkg.sh, then ./vcpkg integrate install followed by ./vcpkg install range-v3. A Conan route with a conanfile.txt and the CMakeDeps generator is also documented.

Which compilers does range-v3 support?

The README lists clang 6 or later, GCC 7 or later, Clang/LLVM 6 or later on Windows, and Visual Studio 2019 or later. On MSVC range-v3 needs /permissive- plus /std:c++latest, /std:c++20 or /std:c++17.

What is the difference between a range-v3 view and an action?

A view adapts a range lazily as it is iterated. An action applies an algorithm eagerly, mutating the container in place and returning it so further stages can process it. Both compose with the pipe operator.

Is range-v3 safe to depend on in production?

The README describes the code as fairly stable and well-tested but lacking documentation, makes no promise about support or long-term stability, and states it will evolve without regard for backwards compatibility. Components inside the ranges::cpp20 namespace are the stated exception.

Official sources

  1. ericniebler/range-v3 on GitHub
  2. Issues
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/ericniebler-range-v3.svg)](https://hysenlabs.com/projects/ericniebler-range-v3)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/ericniebler-range-v3.svg)](https://hysenlabs.com/projects/ericniebler-range-v3)

Was this useful?