All Projects → ericniebler → Range V3

ericniebler / Range V3

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

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Range V3

Easyiterator
🏃 Iterators made easy! Zero cost abstractions for designing and using C++ iterators.
Stars: ✭ 107 (-96.69%)
Mutual labels:  iterator, range
Mir Algorithm
Dlang Core Library
Stars: ✭ 143 (-95.57%)
Mutual labels:  iterator, range
staticstep
Provides truly zero-cost alternatives to Iterator::step_by for both incrementing and decrementing any type that satisfies RangeBounds<T: Copy + Default + Step>.
Stars: ✭ 13 (-99.6%)
Mutual labels:  iterator, range
patterns
Good practices to create code in Java, open to other languages. ⚡
Stars: ✭ 14 (-99.57%)
Mutual labels:  iterator
react-native-daterange-picker
A React Native component for picking date ranges or single dates.
Stars: ✭ 86 (-97.34%)
Mutual labels:  range
HCSR04
Arduino library for HC-SR04, HC-SRF05, DYP-ME007, BLJ-ME007Y, JSN-SR04T ultrasonic ranging sensor
Stars: ✭ 27 (-99.16%)
Mutual labels:  range
Kind Of
Get the native JavaScript type of a value, fast. Used by superstruct, micromatch and many others!
Stars: ✭ 268 (-91.71%)
Mutual labels:  iterator
Iterators
A collection of useful iterators for Haxe
Stars: ✭ 21 (-99.35%)
Mutual labels:  iterator
iteration utilities
Utilities based on Pythons iterators and generators.
Stars: ✭ 65 (-97.99%)
Mutual labels:  iterator
texthighlighter
a no dependency typescript npm package for highlighting user selected text
Stars: ✭ 17 (-99.47%)
Mutual labels:  range
ip scan
Scan a list of IPs quickly using multithreading
Stars: ✭ 13 (-99.6%)
Mutual labels:  range
iterative
Functions for working with iterators in JavaScript and TypeScript
Stars: ✭ 16 (-99.5%)
Mutual labels:  iterator
dogma
Things and stuffs.
Stars: ✭ 22 (-99.32%)
Mutual labels:  iterator
react-simple-range
🔉 React slider component for inputting a numeric value within a range.
Stars: ✭ 20 (-99.38%)
Mutual labels:  range
cron-schedule
A zero-dependency cron parser and scheduler for Node.js, Deno and the browser.
Stars: ✭ 28 (-99.13%)
Mutual labels:  iterator
vl53l0x-linux
Library for interfacing with VL53L0X time-of-flight distance sensor under Linux
Stars: ✭ 19 (-99.41%)
Mutual labels:  range
homebridge-ranger
A HomeKit range extender for Bluetooth Low Energy (BLE) accessories.
Stars: ✭ 65 (-97.99%)
Mutual labels:  range
web-marker
a web page highlighter - Please star if you like this project
Stars: ✭ 51 (-98.42%)
Mutual labels:  range
gen
Simple, efficient iterators for OCaml
Stars: ✭ 42 (-98.7%)
Mutual labels:  iterator
blIteratorAPI
A template library for creating custom iterators
Stars: ✭ 22 (-99.32%)
Mutual labels:  iterator

range-v3

Range library for C++14/17/20. This code was the basis of a formal proposal to add range support to the C++ standard library. That proposal evolved through a Technical Specification, and finally into P0896R4 "The One Ranges Proposal" which was merged into the C++20 working drafts in November 2018.

About:

Ranges are an extension of the Standard Template Library that makes its iterators and algorithms more powerful by making them composable. Unlike other range-like solutions which seek to do away with iterators, in range-v3 ranges are an abstration layer on top of iterators.

Range-v3 is built on three pillars: Views, Actions, and Algorithms. The algorithms are the same as those with which you are already familiar in the STL, except that in range-v3 all the algorithms have overloads that take ranges in addition to the overloads that take iterators. Views are composable adaptations of ranges where the adaptation happens lazily as the view is iterated. And an action is an eager application of an algorithm to a container that mutates the container in-place and returns it for further processing.

Views and actions use the pipe syntax (e.g., rng | adapt1 | adapt2 | ...) so your code is terse and readable from left to right.

Documentation:

Check out the (woefully incomplete) documentation here.

Other resources (mind the dates, the library probably has changed since then):

License:

Most of the source code in this project are mine, and those are under the Boost Software License. Parts are taken from Alex Stepanov's Elements of Programming, Howard Hinnant's libc++, and from the SGI STL. Please see the attached LICENSE file and the CREDITS file for the licensing and acknowledgments.

Supported Compilers

The code is known to work on the following compilers:

  • clang 5.0 (or later)
  • GCC 6.5 (or later)
  • Clang/LLVM 6 (or later) on Windows (older versions may work - we haven't tested.)
  • Visual Studio 2019 (or later) on Windows, with some caveats due to range-v3's strict conformance requirements:
    • range-v3 needs /permissive- and either /std:c++latest or /std:c++17

Development Status: This code is fairly stable, well-tested, and suitable for casual use, although currently lacking documentation. In general, no promise is made about support or long-term stability. This code will evolve without regard to backwards compatibility.

A notable exception is anything found within the ranges::cpp20 namespace. Those components will change rarely or (preferably) never at all.

Build status

  • on GitHub Actions: GitHub Actions Status

Building range-v3 - Using vcpkg

You can download and install range-v3 using the vcpkg dependency manager:

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

The range-v3 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Building range-v3 - Using Conan

You can download and install range-v3 using the Conan dependency manager.

Setup your CMakeLists.txt (see Conan documentation on how to use MSBuild, Meson and others):

project(myproject CXX)

add_executable(${PROJECT_NAME} main.cpp)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) # Include Conan-generated file
conan_basic_setup(TARGETS) # Introduce Conan-generated targets

target_link_libraries(${PROJECT_NAME} CONAN_PKG::range-v3)

Create conanfile.txt in your source dir:

[requires]
range-v3/0.10.0

[generators]
cmake

Install and run conan, then build your project as always:

pip install conan
mkdir build
cd build
conan install ../ --build=missing
cmake ../
cmake --build .

Building range-v3 - Using build2

You can use build2, a dependency manager and a build-system combined, to use range-v3 (or work on it):

Currently this package is available in these package repositories:

Usage:

For example, to make your build2 project depend on range-v3:

  • Add one of the repositories to your configurations, or in your repositories.manifest, if not already there; for example:
    :
    role: prerequisite
    location: https://pkg.cppget.org/1/alpha # v0.11.0 is there.
    
  • Add this package as a dependency to your manifest file (example for v0.11.x):
    depends: range-v3 ~0.11.0
    
  • Import the target and use it as a prerequisite to your own target using range-v3 in the appropriate buildfile:
    import range_v3 = range-v3%lib{range-v3}
    
    lib{mylib} : cxx{**} ... $range_v3
    

Then just build your project as usual (with b or bdep update), build2 will figure out the rest.

For build2 newcomers or to get more details and use cases, you can read this document and the build2 toolchain introduction.

Say Thanks!

I do this work because I love it and because I love C++ and want it to be as excellent as I know it can be. If you like my work and are looking for a way to say thank you, you can leave a supportive comment on my blog. Or you could leave me some kudos on my Open Hub range-v3 contribution page. Just click the Give Kudos button here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].