I have a situation where I have 2 vectors:
vector<char> v1 = {1,3,4}
vector<char> v2 = {4,5,6}
which in reality can grow very large.
What is required of these vectors is that they are each passed into a function with signature:
template<class supports_[]_operator>
double absolutely_awesome_function(const supports_[]_operator& v)
However, i also need the concatenated vector to be passed to this function.
i.e.
v3= {1,3,4,4,5,6}
at which point it is never used again.
Now, there are obviously, a number of ways to simply make a new object and pass that in, however as I said the vectors are large and the 'absolutely_awesome_function' is very fast, so this is obviously not ideal.
I thought about making an object like so:
template<class T>
class AmIAVector{
AmIAVector(const T& vec_1, const T& vec_2)
auto operator [](int i) const {return 'an index into either vec1 or vec2'}
}
But is there a better way / does something already exist for this