For example, let’s say I want to pass the values (1,2),(2,3),(3,4), etc. into a function and have it return a list of numbers, whatever they may be, i.e. 1, 3, 5, 3, 6 after some operations. What is the best way to achieve this result in C++? After moving from python it seems a lot more difficult to do it here, any help?
Share
I’m not saying this is the best way but I think it is pretty good, also from the memory-copying prospective, note I avoid returning a
vector(expensive since it invokes theoperator=implicitly):