I've been trying to understand the Range-v3 join
documentation but I'll be honest, I don't understand it. And I've not been able to find any relevant examples either.
Could someone show me how to create a joined view of two deque vectors please. I've already tried these methods but to no avail.
#include <range/v3/all.hpp>
#include <deque>
#include <iostream>
struct data_t
{
int data;
int some_other_data;
};
auto main() -> int
{
using namespace ranges;
auto v1 = std::deque<data_t>() = { {1,1}, {2,2}, {3,3}, {4,4}, {5,5} };
auto v2 = std::deque<data_t>() = { {6,6}, {7,7}, {8,8}, {9,9}, {10,10} };
auto vv = v1 | ranges::actions::join(v2);
// auto vv = ranges::actions::join(v1, v2); // Tried this too
for(auto v : vv)
{
std::cout << v.data << ", " << std::endl;
}
return 0;
}
Here's a live demo.