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 using ValueType =
typename Container::value_type;
31 for (
auto const &e : c) {
32 out = flatten_impl<ValueType, OutputIterator>::apply(e, out);
39template <
class T,
class OutputIterator>
40struct flatten_impl<T, OutputIterator,
41 std::enable_if_t<std::is_assignable_v<
42 decltype(*std::declval<OutputIterator>()), T>>> {
43 static OutputIterator apply(T
const &v, OutputIterator out) {
63template <
class Range,
class OutputIterator>
64void flatten(Range
const &v, OutputIterator out) {
65 detail::flatten_impl<Range, OutputIterator>::apply(v, out);
void flatten(Range const &v, OutputIterator out)
Flatten a range of ranges.