pipes
pipes copied to clipboard
Move-only type support
It doesn't look like move-only types or move semantics are supported by the library. As a minimal example, I would have expected this to work:
std::vector<std::unique_ptr<int>> input{ std::make_unique<int>(0), std::make_unique<int>(1), std::make_unique<int>(2) };
std::vector<std::unique_ptr<int>> results;
std::move(input) >>= pipes::funnel >>= std::back_inserter(results);
But it tries to copy the std::unique_ptrs and gives a compiler error.
I've attempted to fix this problem with a move pipe with this syntax:
std::vector<std::unique_ptr<int>> input{ std::make_unique<int>(0), std::make_unique<int>(1), std::make_unique<int>(2) };
std::vector<std::unique_ptr<int>> results;
input >>= pipes::move >>= std::back_inserter(results);
What do you think? I'm not 100% convinced with the syntax, the dev is currently in a branch.
I don't see how to implement the syntax std::move(input), because we're not moving the container itself (unless I misunderstood your comment).