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 conforming implementation of C++20 - Only GCC is known to work.

If you are looking for a battle-tested implementation of ranges for older C++ version, use ranges-v3.

ranges::to

ranges::to is a C++23 proposal to convert ranges to a container.

It supports input ranges, nested ranges and container, as well as conversion between containers of pairs and associative containers.

    auto vec = std::views::iota(0, 10) | rangesnext::to<std::vector>();

views::enumerate

Enumerates provide a counter in addition to the value of the underlying view.

for(auto && [index, value] : rangesnext::enumerate({"Hello", "World"})) {
    fmt::print("(index : {}, value : {}) ", index, value);
    // (index: 0, value: "Hello") (index: 1, value: "World")
}

views::product

Cartesian product of multiple views, equivalent to a nested for-loop

std::vector a{'a', 'b', 'c', 'd'};
std::vector b{1, 2, 3};
std::vector c{0.1, 0.2};

for (auto &&[c, d, f] : rangesnext::product(a, b, c)) {
    fmt::print("({} {} {}), ", c, d,n );
    // prints (a, 1, 0.1), (a, 1, 0.2), (a, 2, 0.1), (a, 3, 0.1) ...
}

generator

rangesnext::generator<double> test() {
    double i = 0;
    while(i++ < 5) {
        co_yield i * 2;
    }
}

void  f() {
    std::ranges::for_each(test(), [](double i){
        printf("%f\t", i);
    });
}

This feature requires the -fcoroutines flag under GCC, and might not work properly as the GCC support for coroutines is still experimental.

Usage

This project requires a conformant <ranges> implementation. Only GCC trunk is known to support this library.

Assuming the project is cloned in a rangesnext directory

If your are using cmake:

add_subdirectory(rangesnext EXCLUDE_FROM_ALL)
target_link_libraries(your_target rangesnext)

Otherwise, just add rangesnext/include to the include path.

Similar Resources

Fork of sm64pc/sm64ex ported to iOS devices.

sm64ex-ios Fork of sm64pc/sm64ex ported to iOS devices. Feel free to report bugs and contribute, but remember, there must be no upload of any copyrigh

Jun 16, 2022

Doom ported to a nRF52840-based BLE dongle

nRF52840 Doom Doom port to an nRF52840-based USB BLE dongle, the Adafruit CLUE board, and any device using Nordic Semiconductors nRF52840. Coded by Ni

Mar 14, 2022

An encoding detector library ported from Mozilla

uchardet uchardet moved! uchardet is now a freedesktop project. The page: https://www.freedesktop.org/wiki/Software/uchardet/ Bug reports: https://git

Jun 16, 2022

DOOM ported to the dos-like framework

doom-for-dos-like This is a quick but fairly complete version of the original DOOM ported to the dos-like framework. The data included is for original

Jun 1, 2022

Super Mario War, ported to Miyoo (Bittboy / PocketGo / PowKiddy V90/Q90)

Super Mario World 1.7 (April Fools Edition) Miyoo port v0.1, For Bittboy / PocketGo / PowKiddy V90/Q90 port by andrigamerita/octospacc, based on the b

Mar 3, 2022

Portedplugins - A collection of plugins for the SuperCollider sound environment, all of which are ported / remixed from elsewhere

PortedPlugins A collection of plugins for the SuperCollider sound environment, all of which are ported / remixed from elsewhere - including hardware s

Jun 23, 2022

SuperTux Milestone 1 ported to the Dreamcast (again)

- An introduction for SuperTux - http://super-tux.sf.net/ Last update: April 26, 2004 Dreamcast port by Headshotnoby Turns out this game was alread

Jun 7, 2022

GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features.

GacUI GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features. Read the LICENSE first

Jun 21, 2022

Sol3 (sol2 v3.0) - a C++ - Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

sol2 sol2 is a C++ library binding to Lua. It currently supports all Lua versions 5.1+ (LuaJIT 2.0+ and MoonJIT included). sol2 aims to be easy to use

Jun 23, 2022

A cross platform C99 library to get cpu features at runtime.

cpu_features A cross-platform C library to retrieve CPU features (such as available instructions) at runtime. Table of Contents Design Rationale Code

Jun 13, 2022

A Midnight Commander fork with scripting and other features.

⁝⁝⁝ ⋱הϵѻ⋱ Midnight Commander ⁝⁝⁝ Welcome to the ⋱Neo⋱-MC project! The goals of it are to: make the hidden gem – mcedit – shine and grow to be able to

Apr 23, 2021

A RGB-D SLAM system for structural scenes, which makes use of point-line-plane features and the Manhattan World assumption.

A RGB-D SLAM system for structural scenes, which makes use of point-line-plane features and the Manhattan World assumption.

This repo proposes a RGB-D SLAM system specifically designed for structured environments and aimed at improved tracking and mapping accuracy by relying on geometric features that are extracted from the surrounding.

Jun 21, 2022

A cheatsheet of modern C++ language and library features.

C++20/17/14/11 Overview Many of these descriptions and examples come from various resources (see Acknowledgements section), summarized in my own words

Jun 18, 2022

Build vector tilesets from large collections of GeoJSON features.

Build vector tilesets from large collections of GeoJSON features.

tippecanoe Builds vector tilesets from large (or small) collections of GeoJSON, Geobuf, or CSV features, like these. ⚡ Mapbox has a new service for cr

Jun 20, 2022

YugabyteDB is a high-performance, cloud-native distributed SQL database that aims to support all PostgreSQL features

YugabyteDB is a high-performance, cloud-native distributed SQL database that aims to support all PostgreSQL features

YugabyteDB is a high-performance, cloud-native distributed SQL database that aims to support all PostgreSQL features. It is best to fit for cloud-native OLTP (i.e. real-time, business-critical) applications that need absolute data correctness and require at least one of the following: scalability, high tolerance to failures, or globally-distributed deployments.

Jun 21, 2022

Add extra features to Discord via patches!

DiscordExtras An iOS tweak that lets you apply patches the iOS Discord client. Available on my repo here. Components DiscordExtrasPrefs This includes

May 16, 2022

Poc to test my little friend features without any sdk

poc.vic-hack POC to test my little friend "vector" features without any sdk Ultimate goal - being able to write own firmware components without propri

Feb 26, 2022

C64 Watch is a customized T-Watch 2020 that was inspired by the Commodore 64 computer. It features a C64 theme and a built-in BASIC interpreter.

C64 Watch is a customized T-Watch 2020 that was inspired by the Commodore 64 computer. It features a C64 theme and a built-in BASIC interpreter.

C64 Watch C64 Watch is a customized T-Watch 2020 that was inspired by the Commodore 64 computer. It features a C64 theme and a built-in BASIC interpre

Apr 7, 2022
Comments
  • Fix path names / namespace names

    Fix path names / namespace names

    I just wrote a conan package [1] for your library and noticed that the namespaces and include folders are prefixed by your github username. This is highly uncommon [2][3] and results in the necessity to fix the paths per file using search and replace tools.

    Suggested fix:

    Use the project name ("rangesnext") as the main namespace name and have include files in either ./include or ./include/projectname like all the other libraries.

    [1] https://github.com/richard-vock/conan-rangesnext

    [2] https://google.github.io/styleguide/cppguide.html#Namespace_Names

    [3] https://codingart.readthedocs.io/en/latest/cpp/Naming.html#namespace

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

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 e

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

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 e

Jun 19, 2022
Single-header, ranges-compatible generator type built on C++20 coroutines

generator Single-header, ranges-compatible generator type built with C++20 coroutines. A generator allows implementing sequence producers which are te

Apr 26, 2022
Ranges that didn't make C++20

ranges Implementations of ranges that didn't make C++20. Coded live on Twitch. Types tl::enumerate_view/tl::views::enumerate A view which lets you ite

May 24, 2022
Companion source code for "Programming with C++20 - Concepts, Coroutines, Ranges, and more"
Companion source code for

Companion Source Code for "Programming with C++20 - Concepts, Coroutines, Ranges, and more" 1. Edition Code examples This repository contains runnable

Jun 9, 2022
Numeric algorithms for C++20 Ranges

<numeric> algorithms for C++20 Ranges C++20 includes updated versions of the many algorithms in the <algorithm> header. This header supplements these

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

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 e

Jun 14, 2022
Cross-platform STL-styled and STL-compatible library with implementing containers, ranges, iterators, type traits and other tools; actors system; type-safe config interface.

Yato A small repository where I'm gatherting useful snippets and abstractions for C++ development. Yato includes 3 main modules: multidimensional cont

Mar 7, 2022
DOOM ported to run within the barebox bootloader

bareDOOM bareDOOM is a patchset for the barebox bootloader that integrates DOOM with the available barebox frameworks for framebuffer, input, file sys

Jun 8, 2022
ImmortalWrt is a fork of OpenWrt, with more packages ported, more devices supported, better performance, and special optimizations for mainland China users.

ImmortalWrt is a fork of OpenWrt, with more packages ported, more devices supported, better performance, and special optimizations for mainland China users.

Jan 31, 2022