I have a std::vector with n elements. Now I need to pass a pointer to a vector that has the last n-1 elements to a function.
F
That seems not possible in my situation, since the function I mentioned is the find function of
unordered_set.
Are you using custom hash/predicate function objects? If not, then you must pass unordered_set the pointer to the exact vector that you want to find. A pointer to another vector with the same contents will not work. This is not very useful for lookups, to say the least.
Using unordered_set would be better, because then you could perform lookups by value. I think that would also require a custom hash function object because hash does not to my knowledge have a specialization for vector.
Either way, a pointer into the middle of a vector is not itself a vector, as others have explained. You cannot convert an iterator into a pointer to vector without copying its contents.