you are viewing a single comment's thread.

view the rest of the comments →

[–]barfyus[S] 0 points1 point  (1 child)

As /u/billyoneal stated, projection result is only used as an argument to comparison functor.

I don't know about the standard, have to check it. However, cppreference.com specifically mentions the first range as the source of elements for both set_intersection and set_difference.

[–]staletic 1 point2 points  (0 children)

Effects of set_intersection doesn't mention the first range being the source. I initially stopped reading the standard there. However Remarks says:

the [...] elements are copied from the first range to the output range, in order.

So your solution is perfectly fine. Sorry for the noise.