Javascript can flatten an array:
const nesting = 2;
const arr = [0,[1,[2,3]]].flat(nesting);
console.log(arr);
//output
[0,1,2,3]
It all makes sense because a Javascript array can hold data of mixed types. Can this be expressed using C++ ranges ? Is it possible to nest ranges in this way ?
What about if you want to flatten a vector of vectors:
const vector<vector<int> > vv={{0,1},{2,3}};
auto rg = vv | views::flat;
Is there such a function in the pipeline ?