19#ifndef ESPRESSO_UTILS_FLATTEN_HPP
20#define ESPRESSO_UTILS_FLATTEN_HPP
27template <
class Container,
class OutputIterator,
class =
void>
29 static OutputIterator apply(Container
const &c, OutputIterator out) {
30 for (
auto const &e : c) {
31 out = flatten_impl<
decltype(e), OutputIterator>::apply(e, out);
38template <
class T,
class OutputIterator>
39struct flatten_impl<T, OutputIterator,
40 std::enable_if_t<std::is_assignable_v<
41 decltype(*std::declval<OutputIterator>()), T>>> {
42 static OutputIterator apply(T
const &v, OutputIterator out) {
62template <
class Range,
class OutputIterator>
63void flatten(Range
const &v, OutputIterator out) {
64 detail::flatten_impl<Range, OutputIterator>::apply(v, out);
void flatten(Range const &v, OutputIterator out)
Flatten a range of ranges.