Open MichaelWJung opened 2 years ago
Please consider the following example where I’m trying to concatenate two views over a move-only type:
auto v = views::ints(0, 4) | views::transform([](int i) { return std::make_unique<int>(i); }); auto w = views::ints(4, 8) | views::transform([](int i) { return std::make_unique<int>(i); }); auto x = views::concat(v, w) | to<std::vector>();
Unfortunately, this doesn’t compile for me and I can’t make much sense of the error message (see https://godbolt.org/z/TcoP8djnz).
If I change make_unique to make_shared, i.e. use a copyable type, the code compiles. Evaluating the views before concat also works:
make_unique
make_shared
auto v = views::ints(0, 4) | views::transform([](int i) { return std::make_unique<int>(i); }) | to<std::vector>(); auto w = views::ints(4, 8) | views::transform([](int i) { return std::make_unique<int>(i); }) | to<std::vector>(); auto x = views::concat(v | views::move, w | views::move) | to<std::vector>();
I’ve raised this before as a question on StackOverflow where a user suggested that this might be a bug in range-v3.
Is this a bug? Or am I doing something wrong here?
Is this a bug?
Yes, this is definitely a range-v3 bug.
Please consider the following example where I’m trying to concatenate two views over a move-only type:
Unfortunately, this doesn’t compile for me and I can’t make much sense of the error message (see https://godbolt.org/z/TcoP8djnz).
If I change
make_unique
tomake_shared
, i.e. use a copyable type, the code compiles. Evaluating the views before concat also works:I’ve raised this before as a question on StackOverflow where a user suggested that this might be a bug in range-v3.
Is this a bug? Or am I doing something wrong here?