Open denzor200 opened 2 years ago
Can i write some code like this:
#include <range/v3/all.hpp> #include <vector> #include <iterator> #include <algorithm> #include <iostream> int main() { auto op = [](auto & input, int i, auto & ins) { return input | ranges::views::intersperse(ins) | ranges::to<std::string>(); }; std::string input{"foobarbaxbat"}; char insert{','}; auto rng = op(input, 1, insert); std::cout << rng << '\n'; // Outputs: f,o,o,b,a,r,b,a,x,b,a,t }
without range-v3 library, using Boost.Range instead of range-v3?
I tried to do it by myself, like this: https://godbolt.org/z/xb3vMezdb If there is interest in this, I can move forward and make a PR with tests and doc.
Can i write some code like this:
without range-v3 library, using Boost.Range instead of range-v3?