Intersecting 2 Vectors?

I have 2 vectors & I'm trying to make a third that only contains the similar elements between them.

Example of what I'm going for: (Not formatted properly, just quickly showing)
Vector 1 = "butts stuff things"
Vector 2 = "and butts too"
Vector 3 = "butts" (The 2 vectors contain 1 similar element)

I've been looking at some of the examples online for an algorithm called std::set intersection but I'm kinda lost on how to use it in this specific case.
No one is going to write your code for you.

The example at the following link can be easily modified to do what you want:
http://www.cplusplus.com/reference/algorithm/set_intersection/

Give it a shot. Then if you have problems post your code and someone is likely to help.
Topic archived. No new replies allowed.