I have a vector of vectors that store pointers. Currently I iterate over them and compare each pointer and if I find ones that are not equal then vectors also do not equal, but I wonder if it is the right way to do such a thing.
UPD: std::vector<std::vector<Combination*> > combinations;
If you're comparing the pointers themselves then you can just use operator== on the whole vector (of vectors). What it does is first checks if the sizes of the two vectors are equal. If they are, it subsequently compares each element using operator==. So this works recursively if you have a vector of vectors, or a vector of vectors of vectors. Though it's not technically recursion, since each operator== is actually a different function.
If you're dereferencing the pointers, the way you're doing it is fine. But for that case you could consider using std::equal with an appropriate predicate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With