exptl
General C++20 library that complements the C++ Standard Library
algorithm/hello_world_ranges.cpp

This is an example of how to use the flatten() function, using ranges.

It outputs "Hello, World!"

#include <exptl/algorithm> // flatten
#include <iostream> // cout
#include <iterator> // ostream_iterator
#include <span> // span
#include <vector> // vector
int main()
{
using std::cout, std::ostream_iterator, std::span, std::vector;
vector<vector<vector<int>>> v[][3]{
{{}, {{{72}}}, {{{101, 108}}}},
{{{{108, 111}, {44, 32, 87}}}, {{{111}}, {{114}}, {{108}}}, {{{100}}}},
{{{{33}, {10}}}}};
flatten<int>(span{v}, ostream_iterator<char>(cout));
}
void flatten(In begin, In const end, Out out)
Extracts elements from nested containers.
Definition: algorithm.hpp:37