Is it possible to compose ranges with minmax and join using |

Viewed 48

Given the following example using ranges-v3:

using namespace ranges::views;

std::vector<std::vector<int>> v1 = {
    {1,  2,  3,  17, 5 },
    {11, 12, -1, 14, 15}
};

auto [min_val, max_val] = ranges::minmax(join(v1));

I can get the correct minmax value. But i am wondering if it is possible to use compose with values like join and minmax?

For eg. why can i not do this:

auto [min_val, max_val] = v1 | join() | ranges::minmax();

The compiler error is long and unwieldy, because i am compiling with c++17 and do not have concepts. But i was hoping to understand from the documentation here when i can and cannot use the | (compose) style.

0 Answers
Related