Nordlöw
Nordlöw

Reputation: 12138

Equal C++ STL Container Contents Algorithm

Does STL or Boost contain an algorithm for comparing contents of containers of different types. If not has anybody written such an algorithm. I would call it equal_contents or simply equals. This is useful when asserting that some algorithms return same contents for different input container types.

Upvotes: 2

Views: 1338

Answers (1)

Naveen
Naveen

Reputation: 73443

Yes, there is std::equal algorithm. You need to pass the iterators to this algorithm, the type of container does not matter.

Upvotes: 8

Related Questions