
Another option, still using a variant, is having the output iterator adding variants. In this way all output of the intersection, points,
Hi Barend, Thanks for your answer. Concerning the result of an intersection and using or not a variant : Barend wrote: lines and polygons, are just append to e.g. a vector of variants. This is what I had in mind. But reading your points, I came to the conclusion that it was far from good, and that something simplier could even work : instead of a variant, a tuple of back_inserter could do the trick very nicely. vector<point2D> myPoints; vector<line2D> myLines; vector<polygon2D> myPolygons; typedef tuple<vector<point2D>, vector<line2D>, vector<polygon2D> > AFakeTupleType; intersection_inserter<AFakeTupleType>(poly1, poly2, make_tuple(back_inserter(myPoints), back_inserter(myLines), back_inserter(myPolygons)); Please note there is no object of type AFakeTupleType constructed. This type is just used to drive the algorithm. The output can be dispatched to different vectors, and the input is still 1 object. Then, the user can simply check the lenght of each result to check if there was an intersection. This is less mathematics oriented, but still completely usable, and more simplier, because of the redirection of the result to the selected vectors. You already use tuple, so maybe references wrapper in AFakeTupleType would be needed to make the distinction with your other tuple. What do you think of that? Do you see any drawbacks? Best regards, Pierre