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

Overview

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.

Comments
  • `const`-ness of view operations

    `const`-ness of view operations

    Containers

    Containers in C++ may have both const and non-const overloads of begin. They differ only in their return types: non-const begin returns a mutable iterator, and const begin a constant iterator. Neither overload changes the bits of the container representation or modifies the semantic value of the container object. Two overloads exist so that it is necessary to establish a non-const access path to the container object in order to obtain a mutable iterator. end is the same. size is always const because it provides no way to modify the container's content.

    Views

    Views in range-v3 may have both const and non-const overloads of begin/end/size (herein termed "operations"). Views have pointer semantics - a view is essentially a pointer to a sequence of elements - so mutability of the elements viewed is orthogonal to mutability of the view object itself. The const distinction here has no relation to that of containers. Non-const operations do not modify the semantic objects being viewed, nor do they "swing the pointer" so that the same view designates different semantic objects. Non-const operations mutate internal state that does not contribute to the semantic value of the view; the const-ness here is purely bitwise.

    The const-ness model used by views makes view composition painful. You can always provide the non-const overloads, but const overloads are preferred when achievable. So a composer, e.g.:

    template<typename View>
    class wrap_view : view_facade<wrap_view<View>>
    {
        View base_;
    public:
        wrap_view() = default;
        wrap_view(View v)
        : base_(std::move(v))
        {}
        // ...
    };
    

    ends up providing two definitions of each operation: one const that's constrained to require const operations over the underlying view(s):

        // We need the dependent type V so that range_iterator_t<V const> doesn't hard
        // error when View has no const begin operation (or: use C++14 deduced return type).
        template <typename V = View, CONCEPT_REQUIRES_(Range<View const>())>
        range_iterator_t<V const> begin() const
        { return ranges::begin(base_); }
    

    and one mutable that's constrained to only be available when the const version isn't:

        CONCEPT_REQUIRES(!Range<View const>())
        range_iterator_t<View> begin()
        { return ranges::begin(base_); }
    

    Ranges

    I'm concerned that the differing const distinctions for containers and views don't mesh well into a consistent notion of what const means for operations on general ranges. I see a potential for latent bugs where a programmer accustomed to the fact that calling begin/end on mutable containers is threadsafe calls begin/end on mutable ranges without realizing there are sharp corners here.

    The only mutating operation on pointers is assignment. If views are supposed to be range-pointers, perhaps assignment should be the only mutating operation? We (I) need to investigate an alternative model where view operations are always const and perform internal synchronization if needed.

    opened by CaseyCarter 81
  • [cmake/travis] refactor/improve CMake; add MSan/LSan builds in travis

    [cmake/travis] refactor/improve CMake; add MSan/LSan builds in travis

    • Adds MemorySanitizer and LeakSanitizer (under ASan) in travis:

      • Builds libc++ with MemorySanitizer and AddressSanitizer as required.
      • Enables the leak sanitizer on AddressSanitizer builds under Linux.
      • Enables the unsigned-integer overflow check in the UndefinedBehaviorSanitizer:
        • Avoids overflow in view.unique tests (not a bug).
        • Add RANGES_INTENDED_MODULO_ARITHMETIC macro to explicitly annotate when modulo arithmetic is intended.
        • Explicitly annotates those parts of range-v3 in which modulo arithmetic is intended (mostly in utility/random.hpp).
    • Refactor the root CMakeLists.txt into:

      • cmake/readme.md: brief explanation of what goes where.
      • cmake/ranges_options.cmake: library configuration options.
      • cmake/ranges_env.cmake: detects environment (os, compiler, build type...).
      • cmake/ranges_flags.cmake: sets up supported compiler flags.
    • AppVeyor and Clang/C2 (by @CaseyCarter):

      • Add cmake to PATH in appveyor.yml.
      • Disable -fstruct-vtable-pointers on Clang/C2.
    • Add RANGES_NATIVE option (defaults to On) to allow disabling -march/mtune=native independently of the build-type.

    • Disables std::auto_ptr in boost (not available in C++1z).

    • Add travis build bots for clang-4.0 in C++11 and C++14.

    • Tests clang versions with the corresponding libc++ version (they were always tested with libc++ trunk).

    Closes #333: the ASAN errors reported there cannot be reproduced anymore. Closes #451: -Wnoexcept should be part of -Weverything. Closes #640: clang versions are tested with appropriate libc++ version.

    Thanks @CaseyCarter for the comments, help, and all the Clang/C2 and AppVeyor fixes.

    opened by gnzlbg 42
  • view::cycle

    view::cycle

    Turns a finite ForwardRange into an infinite range that cycles on itself.

    Example

    auto il = {0, 1, 2};
    RANGES_FOR(auto i, il | view::cycle) { std::cout << i << " "; }
    

    prints "0 1 2 0 1 2 0 1 2 0 1 2...".

    Notes on the design

    This designs chooses to make two iterators compare equal only if they point to the same element of the sequence within the same cycle. Example: in the sequence above both iterators begin and begin + 3 point to the same element (0); since they are "in different cycles" they are not equal.

    The rationale is that this allows iterating from [begin, begin + M) where M is larger than the number of elements in the sequence.

    TODO

    • The implementation of cycled_view<Rng>::cursor<IsConst>::advance is pretty ugly.
    • The implementation of cycled_view<Rng>::cursor can be optimized for RandomAccessRanges where the iterator can be obtained from the position in O(1).
    opened by gnzlbg 42
  • Why is filter deprecated?

    Why is filter deprecated?

    I find both filter and remove_if useful. Replacing filter(pred) with remove_if(not(pred)) makes IMO the code less readable. The intent is just harder to understand due to the double negation: do something on the elements that are not the elements for which the predicate is not true (my brain melts).

    opened by gnzlbg 30
  • Proposal: enumerated range

    Proposal: enumerated range

    I find myself doing the following quite often:

    for (const auto& [i, e]: rsv::zip(rsv::iota(0, es.size()), es)) { /* use i, e */ }
    

    This to my mind is more explicit, and leaves less room for mistakes, than:

    for (auto i = 0; i < es.size(); ++i) { /* use i, es[i] */ }
    

    If this idiom is a bad idea, I would appreciate being told why. If not, I think this would be a good candidate for addition to the library, because it is frequently the case that one wants to know the index of the item one is iterating over.

    In my code, I call this enumerated(es), but I'm not particularly attached to this name.

    enhancement 
    opened by seertaak 29
  • Compilation failure because GCC _Safe_iterator meets SizedIteratorRange concept

    Compilation failure because GCC _Safe_iterator meets SizedIteratorRange concept

    I'm getting a compilation failure that I think stems from a (GCC _GLIBCXX_DEBUG) bidirectional iterator meeting the SizedIteratorRange concept and then failing when range-v3 actually uses an expression like itr_a - itr_b.

    I'm guessing the troublesome subtlety may be: the iterator is actually a GCC _Safe_iterator, which does provide an operator-() but which just implements this by passing through to the wrapped std::list iterator that doesn't provide an operator-(). Hence I'm guessing the concepts::same_type(s - i, i - s) line in the SizedIteratorRange concept is checking that the iterator's operator-() exists and has a valid return type but isn't checking that a call to that expression is actually valid. Hence SizedIteratorRange isn't spotting that itr_a - itr_b isn't a valid expression and so doesn't get itself SFINAE-rejected as it should.

    Some illustrative code:

    #define _GLIBCXX_DEBUG
    #define RANGES_NO_STD_FORWARD_DECLARATIONS
    
    #include <iostream>
    #include <list>
    #include <type_traits>
    
    #include <range/v3/all.hpp>
    
    int main() {
        // Background context:
        // Under _GLIBCXX_DEBUG, list returns a list iterator wrapped in a _Safe_iterator
        // whose iterator_category is bidirectional_iterator_tag
        using my_range_type  = std::list< int >;
        using my_iter_type   = decltype( std::begin( std::declval< my_range_type >() ) );
        static_assert(
            std::is_same<
                std::iterator_traits<my_iter_type>::iterator_category,
                std::bidirectional_iterator_tag
            >::value,
            ""
        );
    
        // Background context:
        // range-v3 identifies the _Safe_iterator<...> as SizedIteratorRange
        using rv3_iterator_t = ranges::range_iterator_t< my_range_type >;
        using rv3_sentinel_t = ranges::range_sentinel_t< my_range_type >;
        using rv3_sirc_t     = ranges::sized_iterator_range_concept<rv3_iterator_t,
                                                                    rv3_sentinel_t>;
        ranges::concepts::SizedIteratorRange * my_ptr = rv3_sirc_t();
    
        //  **** PROBLEM HERE *****
        // Fails to compile the '...::take( 3 );' line.
        // I think that's because range-v3 treats _Safe_iterator<...> as a
        // SizedIteratorRange iterator but then cannot subtract one from another
        // (because that's not supported by the underlying list iterator)
        const my_range_type my_values = { 1, 2, 3, 4 };
        const auto my_first_values = my_values | ranges::v3::view::take( 3 );
        std::cerr << *ranges::max_element( my_first_values ) << "\n";
    
        return 0;
    }
    

    Compile command:

    g++ -std=c++11 -isystem range-v3/include -ftemplate-backtrace-limit=0 rv3_safe_iter_prob.cpp
    

    (also works with -std=c++14; -ftemplate-backtrace-limit=0 avoids clipped messages)

    opened by tonyelewis 28
  • Find a better name for iterator_range

    Find a better name for iterator_range

    Especially when dealing with old/current interfaces you sometimes have a pair of begin/end iterators you have to deal with. It would be great if I could e.g. view::all_between(it, it_end) | view::join | ...

    Does something like this exist and I just overlooked it? If not, do you agree, it would be nice to have? I could look into it and maybe create a PR...

    opened by h-2 26
  • Uniform namespace conventions between Meta and Range/utility/Meta

    Uniform namespace conventions between Meta and Range/utility/Meta

    I'm trying to make Range work bootstrapping Meta into it first, instead of having (maintaining) both copies of the same library. My idea is to make this change least intrusive possible. Given the current meta.hpp file in range, what I'm doing is:

    #if defined(BIICODE)
    #include <meta/meta.hpp>
    #else
    #include <type_traits>
    #include <initializer_list>
    #include <range/v3/utility/nullptr_v.hpp>
    #include <range/v3/utility/static_const.hpp>
    ...
    

    The dependency works perfectly, but I'm not able to compile since Meta and Range are using different namespaces to declare/define Meta features. Relying on sorcery like #include inside a nested namespace is not a solution for me, neither for you I guess (Ignoring that trick would potentially generate name issues with STL things etc).

    Maybe we can study the effort neccesary to unify both naming conventions.

    opened by Manu343726 24
  • Add view::shared

    Add view::shared

    Description: view::shared was designed to allow the construction of temporary containers in the middle of the range pipeline (such as inside view::for_each or view::transform). Such temporary containers can be afterwards used in the remaining part of the pipeline, without the danger of dangling references. view::shared allows elegant constructions, which would be otherwise very difficult to express and the code readability would be significantly degraded (see examples at the end of this description).

    Internally, view::shared stores only std::shared_ptr to the underlying range, and therefore construction, destruction, copying and moving of view::shared are still O(1)-time operations, except for the last destruction, which can take up to O(N) time. The linear complexity of the last destruction, however, can be amortized with the time needed to construct the underlying container.

    It can be constructed:

    • from an rvalue reference of a range
    • from std::shared_ptr of a range
    • as a function
    • as a range pipeline element

    Example 1: Apply a transformation function returning a vector, to a range of integers, and flatten the result.

    std::vector<int> foo(int a);
    auto rng =
        view::iota(1)
      | view::transform(foo)
      | view::transform(view::shared)
      | view::join;
    

    Example 2: Build a range which repeats the numbers from a pre-specified vector, but in each epoch, the numbers are randomly shuffled (as is usual e.g., for the training data in machine learning).

    std::vector<int> base{5, 1, 8};
    auto rng =
        view::repeat(base)
      | view::for_each([](std::vector<int> tmp) {
            return std::move(tmp)
                 | action::shuffle(gen)
                 | view::shared;
        });
    

    Stand-alone views: Naturally, view::shared can be used to encapsulate the initial data structure inside a view without bothering with the structure's scope. Therefore, it allows the creation of stand-alone views inside of functions:

    auto build_view()
    {
        std::vector<int> base{5, 1, 8};
        return std::move(base) | view::shared | ...
    }
    
    opened by FloopCZ 23
  • Taking distance() of const ref to view::remove_if fails to compile

    Taking distance() of const ref to view::remove_if fails to compile

    Taking the distance() of a const-lvalue-reference to a view::remove_if fails to compile under both GCC and Clang because it attempts to calculate a type using ranges::range_difference_t<T>, which fails as illustrated in this example:

    #include <range/v3/all.hpp>
    
    int main() {
        int rg[] = { 1, 2, 3, 4, 5 };
    
        // This     const view::tail      is fine
        const auto const_tail_view        = rg | ranges::view::tail;
        using      const_tail_view_diff_t = ranges::range_difference_t< decltype( const_tail_view ) >;
    
        // This non-const view::remove_if is fine
              auto even_view              = rg | ranges::view::remove_if( [] (const int &i) { return ( i % 2 == 0 ); } );
        using      even_view_diff_t       = ranges::range_difference_t< decltype( even_view ) >;
    
        // This     const view::remove_if fails to compile
        const auto const_even_view        = rg | ranges::view::remove_if( [] (const int &i) { return ( i % 2 == 0 ); } );
        using      const_even_view_diff_t = ranges::range_difference_t< decltype( const_even_view ) >;
    
        return 0;
    }
    

    My understanding is that this attempts to compute the type of begin(std::declval<T&>()), which leads to a failed instantiation of the begin_fn::operator()() template, which then fails because neither private impl() function can be used.

    I've found that this problem occurs with both view::remove_if and view::drop_while but not with:

    • view::adjacent_remove_if
    • view::chunk
    • view::delimit
    • view::drop
    • view::replace
    • view::reverse
    • view::slice
    • view::stride
    • view::tail
    • view::take
    • view::take
    • view::take_exactly
    • view::take_while
    opened by tonyelewis 22
  • fix missing includes forever

    fix missing includes forever

    All kudos go to Louis Dione for writing the CMake scripts of Boost.Hana.

    This just adapts his scripts for range-v3; all mistakes introduced are only mine.

    • fix missing includes caught by the tests.
    • replace # warning with #pragma message because -Werror, -Wpedantic complains that # warning is a language extension (this prevents some new tests from compiling).

    Closes #182 .

    opened by gnzlbg 22
  • intermittent failures when running tests

    intermittent failures when running tests

    We have roughly 50% of our GitHub Actions jobs failing the range-v3 tests (using current range-v3 master)

    Test project /home/runner/work/SIRF-SuperBuild/SIRF-SuperBuild/build/builds/range-v3/build
            Start   1: range.v3.test.config
      1/257 Test   #1: range.v3.test.config ..............................   Passed    0.00 sec
            Start   2: range.v3.test.constexpr_core
      2/257 Test   #2: range.v3.test.constexpr_core ......................   Passed    0.00 sec
            Start   3: range.v3.test.multiple
      3/257 Test   #3: range.v3.test.multiple ............................   Passed    0.00 sec
            Start   4: range.v3.test.bug474
      4/257 Test   #4: range.v3.test.bug474 ..............................   Passed    0.00 sec
            Start   5: range.v3.test.bug566
      5/257 Test   #5: range.v3.test.bug566 ..............................   Passed    0.00 sec
            Start   6: range.v3.test.bug1322
      6/257 Test   #6: range.v3.test.bug1322 .............................   Passed    0.00 sec
            Start   7: range.v3.test.bug1335
      7/257 Test   #7: range.v3.test.bug1335 .............................   Passed    0.00 sec
            Start   8: range.v3.test.bug1633
      8/257 Test   #8: range.v3.test.bug1633 .............................   Passed    0.00 sec
            Start   9: range.v3.test.bug1729
      9/257 Test   #9: range.v3.test.bug1729 .............................   Passed    0.00 sec
            Start  10: range.v3.test.act.concepts
     10/257 Test  #10: range.v3.test.act.concepts ........................   Passed    0.00 sec
            Start  11: range.v3.test.act.adjacent_remove_if
     11/257 Test  #11: range.v3.test.act.adjacent_remove_if ..............***Exception: Illegal  0.17 sec
    
            Start  12: range.v3.test.act.drop
     12/257 Test  #12: range.v3.test.act.drop ............................***Exception: Illegal  0.12 sec
    
            Start  13: range.v3.test.act.drop_while
     13/257 Test  #13: range.v3.test.act.drop_while ......................***Exception: Illegal  0.12 sec
    
            Start  14: range.v3.test.act.insert
     14/257 Test  #14: range.v3.test.act.insert ..........................***Exception: Illegal  0.13 sec
    
            Start  15: range.v3.test.act.join
     15/257 Test  #15: range.v3.test.act.join ............................***Exception: Illegal  0.13 sec
    
            Start  16: range.v3.test.act.push_front
     16/257 Test  #16: range.v3.test.act.push_front ......................***Exception: Illegal  0.12 sec
      etc
    

    Example job: https://github.com/SyneRBI/SIRF-SuperBuild/actions/runs/3684701551/jobs/6234749247#step:10:882. (The previous run all tests passed). There is unfortunately going on much more in that job, so I've tried to cut it down in another branch, but this is hard to do with intermittent failures. In essence though, I cannot see how the "other stuff" affects the range-v3 tests, but what could matter is the following:

    • runs on ubuntu-latest, i.e. 22.04
    • gcc9
    • self-built GTest 1.12.1
    • range-v3 master

    Anyone any ideas?

    opened by KrisThielemans 0
  • CMake Multi-Config generator not supported -

    CMake Multi-Config generator not supported - "[range-v3 warning]: unknown build type, defaults to release!"

    Setting a multi-config build generator using the CMake build results in a warning. For example using "Ninja Multi-Config"

    See https://cmake.org/cmake/help/latest/variable/CMAKE_CONFIGURATION_TYPES.html

    Most specifically the genrator-expressions should be used such as $<CONFIG:Debug>. See https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations

    cmake/ranges_env.cmake:82 (message):
    1> [CMake]   [range-v3 warning]: unknown build type, defaults to release!
    
    bug 
    opened by CraigHutchinson 0
  • Allow collecting into std::array if the size is known

    Allow collecting into std::array if the size is known

    I couldn't find any discussion from a quick search in the issues, but have you considered collecting a result from a range into a std::array?

    I understand it's not currently supported since std::array is an aggregate and doesn't have user-defined constructors to accept the ranges/iterators (beyond the obvious reason that for many ranges we can't expect to know the size at compile-time).

    That being said, and while I don't know the intricacies of the ranges::to<>, nor do I have extensive knowledge of C++ templates, I toyed around and made it do what I want in a simple case (see on Compiler Explorer).

    But I figured it would be good to hear from someone more experienced with the library and its internals.

    opened by dingari 1
  • Concept error: satisfaction of atomic constraint '__is_constructible(T) [with Args = {I}; T = I]' depends on itself

    Concept error: satisfaction of atomic constraint '__is_constructible(T) [with Args = {I}; T = I]' depends on itself

    Hi,

    the following concepts cause a cryptic error within the range-v3 v.0.12 library when used with GCC-11 or GCC-12 (linux):

    template < typename MapLike >
    concept mapping = requires(MapLike m) {
                         // has to be key-value-like to iterate over values and keys only repsectively
                         ranges::views::keys(m);
                         ranges::views::values(m);
                      };
    
    template < typename MapLike, typename KeyType >
    concept maps = mapping< MapLike >
                   and std::is_convertible_v<    // value type has to be convertible to the Mapped Type
                      decltype(*(ranges::views::keys(std::declval< MapLike >()).begin())),
                      KeyType >;
    

    the error message goes deep within the range-v3 concepts:

    /opt/compiler-explorer/libs/rangesv3/0.12.0/include/range/v3/view/all.hpp: In instantiation of 'constexpr auto ranges::views::all_fn::operator()(T&&) const [with T = const Hashmap&]': /opt/compiler-explorer/libs/rangesv3/0.12.0/include/range/v3/view/all.hpp:91:35: required by substitution of 'template requires (viewable_range) && (input_range) && (kv_pair_like_<decltype((declval<decltype(ranges::_::begin(static_cast<Rng& ()()noexcept (true)>(nullptr)()))&>)())>) ranges::keys_range_view<decltype (ranges::views::all(declval()))> ranges::views::keys_fn::operator()(Rng&&) const [with Rng = const Hashmap&]'

    :15:41: required by substitution of 'template requires maps Hashmap::Hashmap(U&&) [with U = int]' /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1153:13: required from 'constexpr auto ranges::views::all_fn::operator()(T&&) const [with T = Hashmap&]' /opt/compiler-explorer/libs/rangesv3/0.12.0/include/range/v3/view/all.hpp:91:35: required by substitution of 'template requires (viewable_range) && (input_range) && (kv_pair_like_(nullptr)()))&>)())>) ranges::values_view()))> ranges::views::values_fn::operator()(Rng&&) const [with Rng = Hashmap&]' /opt/compiler-explorer/libs/rangesv3/0.12.0/include/range/v3/functional/invoke.hpp:140:34: required by substitution of 'template constexpr decltype ((F&&)(f)((Args&&(ranges::invoke_fn::operator()::args))...)) ranges::invoke_fn::operator()(F&&, Args&& ...) const [with F = ranges::views::values_fn; Args = {Hashmap&}]' /opt/compiler-explorer/libs/rangesv3/0.12.0/include/range/v3/functional/concepts.hpp:40:5: required by substitution of 'template requires (viewable_range) && (invocable_view_closure) constexpr auto ranges::views::view_closure_base_ns::operator|(Rng&&, ranges::views::view_closure) [with Rng = Hashmap&; ViewFn = ranges::views::values_fn]' :60:36: required from here /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1151:21: required for the satisfaction of 'constructible_from' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1170:9: required for the satisfaction of 'copy_constructible_concept_' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1181:21: required for the satisfaction of 'copy_constructible' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1209:21: required for the satisfaction of 'copyable' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1217:21: required for the satisfaction of 'semiregular' [with T = Hashmap] cc1plus: error: satisfaction of atomic constraint '__is_constructible(T) [with Args = {const I}; T = I]' depends on itself /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1151:21: required for the satisfaction of 'constructible_from' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1170:9: required for the satisfaction of 'copy_constructible_concept_' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1181:21: required for the satisfaction of 'copy_constructible' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1209:21: required for the satisfaction of 'copyable' [with T = Hashmap] /opt/compiler-explorer/libs/rangesv3/0.12.0/include/concepts/concepts.hpp:1217:21: required for the satisfaction of 'semiregular' [with T = Hashmap] cc1plus: error: satisfaction of atomic constraint '__is_constructible(T) [with Args = {const I}; T = I]' depends on itself

    I am using this concept in my code to filter out maps over certain key types (maybe this isn't the best way) and this error has been bugging me for a while now.

    Here is a godbolt link to verify the problem on GCC 11/12. It does work e.g. under clang 15: https://godbolt.org/z/dqj1YY9e4

    The problem does not exist with std::ranges and GCC, but it does for clang now: https://godbolt.org/z/a88WMe66b

    opened by maichmueller 0
  • drop_while view and sorted range : possible optimization?

    drop_while view and sorted range : possible optimization?

    Hi, Reading drop_while page I think it would be handy to be able to tell that we are iterating an already sorted range, when applicable.

    Right now, it seems to iterate every elements, whereas it could use a binary search to go faster.

    opened by LumiereDeLOmbre 4
Releases(0.12.0)
  • 0.12.0(Jun 21, 2022)

    Released: June 21, 2022

    IMPORTANT: This release deprecates views::group_by which was an endless source of confusion. group_by is replaced with views::chunk_by (which, beware, has subtly different semantics, see below.)

    Changes:

    • NEW: views::chunk_by which, like the old views::group_by it replaces, splits a range into a range-of-ranges, where adjacent elements satisfy a binary predicate (#1648). [Note: Whereas views::group_by evaluated the predicate between the current element and the first element in the chunk, views::chunk_by evaluates the predicate between adjacent elements. -- end note]
    • NEW: constexpr all the algorithms that are constexpr in C++20's std::ranges (#1683).
    • NEW: Fold algorithms from P2322 (#1628), (#1668).
    • NEW: ranges::unformatted_ostream_iterator (#1586).
    • NEW: Support for the build2 build system (#1562).
    • Implement P2328: relax the constraint on ranges::join_view to support joining ranges of prvalue non-view ranges (#1655).
    • Improved algorithm for ranges::linear_distribute (#1679).
    • Renamed safe_subrange_t to borrowed_subrange_t (#1542).
    • Extend ranges::to to support conversion to container-of-containers (#1553).
    • views::enumerate can be a borrowed_view (#1571).
    • ranges::upper_bound works in the presence of overloaded operator& (#1632).
    • Input iterators are no longer required to be default-constructible (#1652).

    Bugs fixed:

    • ranges::to<std::map>(v) does not work (#1700)
    • ranges::reverse_iterator has the wrong value_type when reversing a proxy range (#1670).
    • A post-increment of a ranges::counted_iterator wrapping an input iterator with a void-returning post-increment operator isn't incrementing the count (#1664).
    • Bad assert in views::drop_last (#1599).
    • Read of uninitialized bool in views::cache1 (#1610).
    • ranges::unstable_remove_if calls predicate on same element twice (#1629).
    • ranges::on(f,g)(x...) should be f(g(x)...) instead of f(g(x...)) (#1661).
    • Broken qualification of cmake targets (#1557).
    • Various portability and documentation fixes.

    Credits: I would like to thank the following people who contributed to this release (in no particular order): Barry Revzin, @dvirtz, Gonzalo Brito, Johel Ernesto Guerrero Peña, Joël Lamotte, Doug Roeper, Facundo Tuesca, Vitaly Zaitsev, @23rd, @furkanusta, Jonathan Haigh, @SmorkalovG, @marehr, Matt Beardsley, Chris Glover, Louis Dionne, Jin Shang (@js8544), Hui Xie, @huixie90, Robert Maynard, Silver Zachara, @sergegers, Théo DELRIEU, @LesnyRumcajs, Yehezkel Bernat, Maciej Patro, Klemens Nanni, Thomas Madlener, and Jason Merrill.

    :tada: Special thanks to Barry Revzin for stepping up to be part-time co-maintainer of range-v3. :tada:

    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Aug 6, 2020)

    Released: August 6, 2020

    IMPORTANT: This release removes the heuristic that tries to guess whether a range type is a "view" (lightweight, non-owning range), in accordance with the C++20. This is a potentially source-breaking change. Code that previously used an rvalue range as the start of a pipeline could stop compiling if the range library is not explicitly told that that range type is a view. To override the new default, please specialize the ranges::enable_view<R> Boolean variable template.

    IMPORTANT: This release removes the implicit conversion from views to containers. To construct a container from an arbitrary range, you must now explicitly use ranges::to. For example, the following code no longer works:

    std::vector<int> is = ranges::views::ints(0, 10); // ERROR: no conversion
    

    Instead, please write this as:

    auto is = ranges::views::ints(0, 10) | ranges::to<std::vector>; // OK
    

    ranges::to lives in header <range/v3/range/conversion.hpp>

    IMPORTANT: This release drops support for llvm-3.9.

    Changes:

    • NEW: A new concepts portability layer that short-circuits atomic constraints in requires clauses for better compile times when emulating concepts.
    • NEW: Restored support for MSVC in /std:c++17 mode, and for MSVC's default preprocessor.
    • Remove the implicit conversion from views to containers.
    • Rename the following entities to be consistent with C++20's std::ranges support:
      • safe_range<R> -> borrowed_range<R>
      • enable_safe_range<R> -> enable_borrowed_range<R>
      • safe_iterator_t<R> -> borrowed_iterator_t<R>
      • safe_subrange_t<R> -> borrowed_subrange_t<R>
      • readable_traits<I> -> indirectly_readable_traits<I>
      • readable<I> -> indirectly_readable<I>
      • writable<I> -> indirectly_writable<I>
    • Added the following to the ranges::cpp20 namespace:
      • Algorithm for_each_n
      • Algorithm sample
      • Class view_base
      • Alias views::all_t
    • Type __int128 is recognized as "integer-like".
    • Adds concepts three_way_comparable[_with] when <=> is supported.
    • Adds concepts partially_ordered[_with].
    • Better conformance with C++20's use of the boolean-testable concept.
    • Support C++20 coroutines.
    • Honor CMake's CMAKE_CXX_STANDARD variable.
    • A fix for the cardinality of views::zip[_with] (#1486).
    • Add view_interface::data() member function.
    • Add necessary specializations for std::basic_common_reference and std::common_type.
    • Numerous workarounds for MSVC.
    • Various CMake fixes and improvements.
    • drop_while_view is not a sized_range.
    • Added support for Wind River Systems.
    • Bug fixes to views::group_by (#1393).
    • common_[reference|type] of common_[tuple|pair] now yields a common_[tuple|pair] instead of a std::[tuple|pair] (#1422).
    • Avoid UB when currying an lvalue in some views and actions (#1320).

    Credits: I would like to thank the following people who contributed to this release (in no particular order): Christopher Di Bella, @marehr, Casey Carter, Dvir Yitzchaki, Justin Riddell, Johel Ernesto Guerrero Peña, Barry Revzin, Kamlesh Kumar, and Vincas Dargis.

    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Dec 7, 2019)

    Released: Dec 6, 2019.

    IMPORTANT: Before upgrading, please note that several older compiler versions and build configurations are no longer supported! In particular, MSVC now needs /std:c++latest.

    ALSO: When taking a dependency on the range-v3, meta, or concepts libraries via CMake, please now use the namespace qualified target names:

    • range-v3::range-v3
    • range-v3::meta
    • range-v3::concepts

    Changes:

    • NEW: Rewritten concepts portability layer with simpler macros for better diagnostics.
    • NEW: The views::cache1 view caches the most recent value in the range. This can help avoid reevaluation of transformations in complex view pipelines.
    • NEW: ranges::contains algorithm.
    • NEW: enable_safe_range trait for opting in to the forwarding-range concept. These are ranges whose iterators remain valid even after the range itself has been destroyed; e.g., std::string_view and ranges::subrange.
    • The readable concept has changed such that types that are not indirectly readable with operator* (_e.g., std::optional) no longer satisfy that concept.
    • Using views::join to join a range of xvalue ranges works again.
    • The following range access primitives no longer accept temporary containers (i.e., they refuse to return references known to be dangling):
      • range::front
      • range::back
      • range::at
      • range::index
    • views::concat with a single argument now simply returns its argument.
    • ranges::ostream_iterator<T> now coerces arguments to T before inserting them into the wrapped ostream.
    • Smaller iterators for views::transform and views::take_while.
    • actions::split and actions::split_when now support partial application and pipelining (#1085).
    • views::group_by and its iterator both get a .base() member to access the underlying range and iterator, respectively.
    • Improved diagnostics with clang.
    • Assorted bug fixes and compiler work-arounds: #284, #491, #499, #871, #1022, #1043, #1081, #1085, #1101, #1116, #1296, #1305, and #1335.

    Many thanks to GitHub users @CaseyCarter, @morinmorin, @h-2, @MichaelWJung, @johelegp, @marehr, @alkino, @xuning97, @BRevzin, and @mpusz for their contributions.

    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Aug 25, 2019)

    Released: Aug 26, 2019.

    Bring many interfaces into sync with the C++20 draft.

    • NEW: An improved concepts portability layer with macros that use C++20 concepts when the compiler supports them.

    • NEW: An improved directory structure that keeps disjoint parts of the library -- iterators, ranges, algorithms, actions, views, functional programming support, and general utilities -- physically separate.

    • NEW: A RANGES_DEEP_STL_INTEGRATION configuration option that makes your STL implementation default to structural conformance to infer iterator category, as in C++20. Applies to libc++, libstdc++, and MSVC's Standard Library.

    • NEW: A ranges::cpp20 namespace that contains all the functionality of C++20's std::ranges namespace.

    • All concept names have been given standard_case (renamed from PascalCase) and have been harmonized with the C++20 draft.

    • The following range access customization points no longer accept rvalue ranges by default:

      • ranges::begin
      • ranges::end
      • ranges::rbegin
      • ranges::rend
      • ranges::cbegin
      • ranges::cend
      • ranges::crbegin
      • ranges::crend
      • ranges::data
      • ranges::cdata
    • Iterators may specify an iterator_concept type alias in addition to iterator_category -- either as a nested type or as a member of a std::iterator_traits specialization -- to denote conformance to the C++20 iterator concepts as distinct from the C++98 iterator requirements. (See P1037 "Deep Integration of the Ranges TS" for more information.)

    • The ranges::value_type trait has been renamed to readable_traits.

    • The ranges::difference_type trait has been renamed to incrementable_traits.

    • The ranges::iterator_category trait has been deprecated. Specialize std::iterator_traits to non-intrusively specify an iterator's category and (optionally) concept.

    • Rename the ranges::view namespace to ranges::views and ranges::action to ranges::actions (with deprecated namespace aliases for migration).

    • Rename view::bounded to views::common.

    • Rename unreachable to unreachable_sentinel_t.

    • Change dangling from a class template that wraps an iterator to a class that acts as a placeholder for an iterator that would otherwise dangle.

    • Implement C++20's subrange as a view that wraps an iterator/sentinel pair; deprecate iterator_range.

    • Deprecate implicit conversion from view types to containers; rename ranges::to_ to ranges::to and extend it to support converting a range-of-ranges to a container-of-containers.

    • Deprecate the ranges::v3 inline versioning namespace.

    • The following views have had minor changes to bring them into conformance with the C++20 working draft:

      • join_view
      • single_view
      • empty_view
      • split_view
      • reverse_view
      • all_view
      • take_view
      • iota_view

      `iota_view`, in particular, is given a user-defined `difference_type` that avoids integer overflow.

    • New names for the iterator and range type aliases:

      | Old Name | New Name | |-------------------------------|-----------------------------| | value_type_t | iter_value_t | | reference_t | iter_reference_t | | difference_type_t | iter_difference_t | | size_type_t | deprecated | | rvalue_reference_t | iter_rvalue_reference_t | | range_value_type_t | range_value_t | | range_difference_type_t | range_difference_t | | range_size_type_t | range_size_t |

    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Apr 30, 2019)

    • NEW: MSVC support, from @CaseyCarter :tada: (See the docs for the list of supported compilers.)
    • NEW: view::enumerate, from @MikeGitb
    • NEW: view::addressof, from @tower120
    • NEW: unstable_remove_if algorithm and action, from @tower120
    • NEW: adjacent_remove_if algorithm and action, from @tower120
    • NEW: ostream_joiner, from @sv1990
    • view::drop_while and view::take_while get projection support, from @mrpi
    • view::filter and view::remove_if get projection support, from @mrpi
    • view::unique accepts optional comparison operator, from @tete17
    • action::slice supports sliding from the end, from @tete17
    • Support coroutines on MSVC, from @CaseyCarter
    • Faster view::generate_n, from GitHub user @tower120
    • Improved aligned new detection for libc++ on iOS, from @mtak-
    • Various CMake improvements, from @johelegp
    • view_adaptor supports basic_iterator-style mixins, from @tower120
    • Fix ranges::advance for random-access iterators for n==0, from @tower120
    • Bugs fixed: #755, #759, #942, #946, #952, #975, #978, #986, #996, #1041, #1047, #1088, #1094, #1107, #1129
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Oct 18, 2018)

    0.4.0 Oct 18, 2018

    • Minor interface-breaking changes:
      • single_view returns by const & (see #817).
      • reverse_view of a non-Sized, non-Bounded RandomAccess range (eg., a null-terminated string) no longer satisfies SizedRange.
      • The generate and generate_n views now return the generated values by xvalue reference (T &&) to the value cached within the view (see #905).
      • Views no longer prefer returning constant iterators when they can; some views have different constant and mutable iterators.
    • Enhancements:
      • Views can successfully adapt other views that have different constant and mutable iterators.
      • The single, empty, and reverse views are much closer to the versions as specified in P0896.
    • Bug fixes:
      • "single_view should not copy the value" #817.
      • "Calling back() on strided range does not return the correct last value in range" #901.
      • "generate(foo) | take(n) calls foo n+1 times" #819.
      • "generate seems broken with move-only return types" #905.
      • "Unexpected behavior in generate with return by reference" #807.
      • "Inconsistent behaviour of ranges::distance with ranges::view::zip using infinite views." #783.
      • "Infinite loop when using ranges::view::cycle with an infinite range" #780.
      • "Composing ranges::view::cycle with ranges::view::slice" #778.
      • "cartesian_product view, now with moar bugs." #919.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.7(Sep 20, 2018)

    0.3.7 Sept 19, 2018

    • Improved support for clang-cl (thanks to @CaseyCarter).
    • Fix for any_view<T, category::sized | category::input> (see #869).
    • Fix iter_move of a ranges::reverse_iterator (see #888).
    • Fix move_sentinel comparisons (see #889).
    • Avoid ambiguity created by boost::advance and std::advance (see #893).
    Source code(tar.gz)
    Source code(zip)
  • 0.3.6(May 15, 2018)

    • 0.3.6 May 15, 2018
      • NEW: view::exclusive_scan (thanks to GitHub user @mitsutaka-takeda).
      • All views get non-const overloads of .empty() and .size() (see ericniebler/stl2#793).
      • Upgrade Conan support for conan 1.0.
      • subspan interface tweaks.
      • Fix bug in view::split (see this stackoverflow question).
      • Fix bug in view::stride (see ericniebler/stl2#805).
      • Fix const-correctness problem in view::chunk (see this stackoverflow question).
      • Replace uses of ranges::result_of with ranges::invoke_result.
      • Fix potential buffer overrun of view::drop over RandomAccessRanges.
      • Lots of view::cartesian_product fixes (see ericniebler/stl2#820, ericniebler/stl2#823).
      • Work around gcc-8 regression regarding volatile std::initializer_lists (see ericniebler/stl2#826).
      • Fix const-correctness problem of view::take.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.5(Feb 17, 2018)

    0.3.5 February 17, 2018

    • Rvalues may satisfy Writable (see ericniebler/stl2#387).
    • view_interface gets a bounds-checking at method.
    • chunk_view works on Input ranges.
    • Fix bug in group_by_view.
    • Improved concept checks for partial_sum numeric algorithm.
    • Define ContiguousIterator concept and contiguous_iterator_tag iterator category tag.
    • Sundry span fixes.
    • action::insert avoids interfering with vector's exponentional growth strategy.
    • Add an experimental shared view for views that need container-like scratch space to do their work.
    • Faster, simpler reverse_view.
    • Rework ranges::reference_wrapper to avoid LWG#2993.
    • Reworked any_view, the type-erased view wrapper.
    • equal algorithm is constexpr in C++14.
    • stride_view no longer needs an atomic data member.
    • const-correct drop_view.
    • adjacent_filter_view supports bidirectional iteration.
    • Massive view_adaptor cleanup to remove the need for a mutable data member holding the adapted view.
    • Fix counting_iterator post-increment bug.
    • tail_view of an empty range is an empty range, not undefined behavior.
    • Various portability fixes for gcc and clang trunk.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jun 30, 2017)

    0.3.0 June 30, 2017

    • Input views may now be move-only (from @CaseyCarter)
    • Input any_views are now much more efficient (from @CaseyCarter)
    • Better support for systems lacking a working <thread> header (from @CaseyCarter)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.6(Jun 21, 2017)

    0.2.6 2017-06-21

    • Experimental coroutines with ranges::experimental::generator (from @CaseyCarter)
    • ranges::optional now behaves like std::optional (from @CaseyCarter)
    • Extensive bug fixes with Input ranges (from @CaseyCarter)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.5(May 16, 2017)

    • view::chunk works on Input ranges (from @CaseyCarter)
    • for_each_n algorithm (from @khlebnikov)
    • Portability fixes for MinGW, clang-3.6 and -3.7, and gcc-7; and cmake 3.0
    Source code(tar.gz)
    Source code(zip)
  • 0.2.4(Apr 13, 2017)

    0.2.4 April 12, 2017 Fix the following bug:

    • action::stable_sort of vector broken on Clang 3.8.1 since ~last Xmas (ericniebler/range-v3#632).
    Source code(tar.gz)
    Source code(zip)
  • 0.2.3(Apr 4, 2017)

  • 0.2.2(Mar 30, 2017)

    New in this release:

    • view::linear_distribute(from,to,n) - A view of n elements between from and to, distributed evenly.
    • view::indices(n) - A view of the indices [0,1,2...n-1].
    • view::closed_indices(n) - A view of the indices [0,1,2...n].

    This release also deprecates view::ints(n) as confusing to new users.

    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Mar 22, 2017)

  • 0.2.0(Mar 13, 2017)

    Bring many interfaces into sync with the Ranges TS.

    • Many interfaces are simply renamed. The following table shows the old names and the new. (All names are in the ranges::v3 namespace.)

      | Old Name | New Name | |-------------------------------|---------------------------| | indirect_swap | iter_swap | | indirect_move | iter_move | | iterator_value_t | value_type_t | | iterator_reference_t | reference_t | | iterator_difference_t | difference_type_t | | iterator_size_t | size_type_t | | iterator_rvalue_reference_t | rvalue_reference_t | | iterator_common_reference_t | iter_common_reference_t | | range_value_t | range_value_type_t | | range_difference_t | range_difference_type_t | | range_size_t | range_size_type_t | | range_iterator_t | iterator_t | | range_sentinel_t | sentinel_t |

    • common_iterator now requires that its two types (Iterator and Sentinel) are different. Use common_iterator_t<I, S> to get the old behavior (i.e., if the two types are the same, it is an alias for I; otherwise, it is common_iterator<I, S>).

    • The following iterator adaptors now work with iterators that return proxies from their postfix increment operator (i.e., operator++(int)):

      • common_iterator
      • counted_iterator
    • The following customization points are now implemented per the Ranges TS spec and will no longer find the associated unconstrained overload in namespace std:::

      • ranges::begin
      • ranges::end
      • ranges::size
      • ranges::swap
      • ranges::iter_swap

      (In practice, this has very little effect but it may effect overloading in rare situations.)

    • ranges::is_swappable now only takes one template parameter. The new ranges::is_swappable_with<T, U> tests whether T and U are swappable. ranges::is_swappable<T> is equivalent to ranges::is_swappable_with<T &, T &>.

    • The following object concepts have changed to conform with the Ranges TS specification, and approved changes (see P0547):

      • Destructible
      • Constructible
      • DefaultConstructible
      • MoveConstructible
      • CopyConstructible
      • Movable
      • Assignable
    • The View concept is no longer satisfied by reference types.

    • is_view is now called enable_view

    • The syntax for defining a concept has changed slightly. See utility/iterator_concepts.hpp for examples.

    This release drops support for gcc 4.8.

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Mar 13, 2017)

  • 0.1.0(Mar 8, 2017)

Owner
Eric Niebler
Member of the ISO C++ Standardization Committee and principal author of the Ranges TS.
Eric Niebler
ranges features for c+23 ported to C++20

Ranges For C++23 This repository implements a set of views intended to be proposed to a future C++ standard. The library can only be used with a confo

cor3ntin 63 Dec 24, 2022
Range-based goodness for C++17

NanoRange NanoRange is a C++17 implementation of the C++20 Ranges proposals (formerly the Ranges TS). It provides SFINAE-based implementations of all

Tristan Brindle 333 Dec 17, 2022
A standard conforming C++20 implementation of std::optional.

A standard conforming C++20 implementation of std::optional.

null 31 Aug 24, 2022
C++11/14/17 std::expected with functional-style extensions

expected Single header implementation of std::expected with functional-style extensions. Clang + GCC: MSVC: Available on Vcpkg and Conan. std::expecte

Sy Brand 946 Jan 1, 2023
A collection of std-like single-header C++ libraries

itlib: iboB's Template Libraries A collection of small single-header C++ libraries similar to or extending the C++ standard library. See below for a l

Borislav Stanimirov 98 Dec 29, 2022
C++11/14/17 std::optional with functional-style extensions and reference support

optional Single header implementation of std::optional with functional-style extensions and support for references. Clang + GCC: MSVC: std::optional i

Sy Brand 699 Dec 23, 2022
Monadic interface for std::optional

optional Simple monadic interface for std::optional Installation Just copy and include optional.h header in your project Usage All operations are in b

null 8 Apr 15, 2022
Allows a programmer to print table-like outputs over std::ostream.

tableprinter Allows a programmer to print table-like outputs over std::ostream. It is a header only library. No other dependency than STL. Provides re

null 24 Jul 7, 2022
Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more

fu2::function an improved drop-in replacement to std::function Provides improved implementations of std::function: copyable fu2::function move-only fu

Denis Blank 429 Dec 12, 2022
Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

?? Index What is Libft? List of Functions Technologies ✨ What is Libft? Libft is an individual project at 42 that requires us to re-create some standa

Paulo Rafael Ramalho 7 Jan 17, 2022
Library that simplify to find header for class from STL library.

Library that simplify to find header for class from STL library. Instead of searching header for some class you can just include header with the class name.

null 6 Jun 7, 2022
Thrust is a C++ parallel programming library which resembles the C++ Standard Library.

Thrust: Code at the speed of light Thrust is a C++ parallel programming library which resembles the C++ Standard Library. Thrust's high-level interfac

NVIDIA Corporation 4.3k Dec 31, 2022
jkds is a modern header-only C++20 library that complements the standard library.

jkds is a modern header-only C++20 library that complements the standard library. It provides generic atypical data structures, ergonomic functional programming abstractions, and then some.

Alberto Schiabel 6 Nov 16, 2022
Bionic BSD-3-ClauseBionic - Google's standard library, developed for Android. BSD-3-Clause

bionic bionic is Android's C library, math library, and dynamic linker. Using bionic as an app developer See the user documentation. Working on bionic

Android Open Source Project 564 Dec 31, 2022
CloudABI's standard C library

NOTE: This project is unmaintained CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustai

Nuxi 277 Dec 15, 2022
libcu++: The C++ Standard Library for Your Entire System

libcu++, the NVIDIA C++ Standard Library, is the C++ Standard Library for your entire system. It provides a heterogeneous implementation of the C++ Standard Library that can be used in and between CPU and GPU code.

NVIDIA Corporation 2.1k Jan 2, 2023
D++ Extremely Lightweight C++ Discord Library

D++ An incredibly lightweight C++ Discord library This project is in alpha stages of development. Completed so far: Websocket connection with heartbea

brainbox.cc 583 Jan 2, 2023
EASTL stands for Electronic Arts Standard C++ Template Library

EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.

Electronic Arts 6.9k Dec 27, 2022
An open source standard C library that includes useful functions && (Reimplementation of libc functions + own functions).

?? LIBFT-42 : Artistic view of LIBC: ?? HOW DOES IT FEEL HAVING YOUR OWN LIB: SUBJECT : ENGLISH PDF ℹ️ What is LIBFT : This project aims to code a C l

Abdessamad Laamimi 10 Nov 4, 2022