getting offset from iterator for use in another container

This is a discussion on getting offset from iterator for use in another container within the C++ Programming forums, part of the General Programming Boards category; Hello,
I have two vectors (of different types) whose elements correspond to each other. I'm going through vector<foo> A using ...

getting offset from iterator for use in another container

Hello,
I have two vectors (of different types) whose elements correspond to each other. I'm going through vector<foo> A using find_if and removing some elements. I want to remove the corresponding elements in vector<bar> B. What is the cleanest way? I don't think that

Well the desire to do so points to a design error. If vector B's element's depend on vector A's elements, then you should instead have a list of foo bar pairs, or perhaps one of the object types should hold the other.

But if you want to force a way to do it, then yeah iter-A.begin is as good a way as any. Or you can forget about find_if, and use an indexed for loop.

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !