ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.05k stars 437 forks source link

Is there an approach to concat 2 vector? #1820

Closed dangdkhanh closed 2 weeks ago

dangdkhanh commented 3 weeks ago

Hi, Is there an efficient way to concatenate 2 vectors but in element order with range-v3? vector v1{1,2,3}; vector v2{4,5,6}; output : {1,4,2,5,3,6};

Thanks you!

brevzin commented 2 weeks ago

The calendar example has an interleave_view which is what you're looking for, but nothing in the library proper: https://github.com/ericniebler/range-v3/blob/53c40dd628450c977ee1558285ff43e0613fa7a9/example/calendar.cpp#L189-L251

dangdkhanh commented 2 weeks ago

Hi @brevzin , Thank you. I missed it.