Quantcast
Channel: User rmn - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by rmn for comparing two vectors, make it more efficient

$
0
0

I imagine any implementation you'd have would start with verifying that array sizes are equal and then continue with going over the elements one by one and comparing them (returning false as soon as it can - on the first difference). So your suggestion does not help by much, and neither does std::mismatch.

However, if you could keep your vectors sorted, perhaps a smarter check could be feasible. Can you?


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>