Reputation: 151
If I have:
A = {"one", "two", "three"}
B = {"one", "two"}
I want to avoid creating a new vector from A. Is there a way to use [A.begin(), A.begin()+1] to compare with B?
Upvotes: 0
Views: 45
Reputation: 281
There is a version of std::equal that could do:
template< class InputIt1, class InputIt2 >
bool equal( InputIt1 first1, InputIt1 last1,
InputIt2 first2, InputIt2 last2 );
https://en.cppreference.com/w/cpp/algorithm/equal
Upvotes: 7