Boost logo

Geometry :

Subject: [geometry] Improved Variant support
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2015-05-06 10:45:40


Currently the use of Variants (and in general run-time Geometries) can be
problematic. It's because if Variant objects are passed into an algorithm
the code for all possible combinations of types is generated which results
in a compile-time error. Example:

within(pt, poly); // compiles
//within(poly, pt); // fails - not implemented

boost::variant<pt_t, poly_t> v1, v2;
within(v1, v2); // does not compile

The above code doesn't compile because the code calling within(poly, pt) is
generated by the compiler.

I prepared a PR changing it:

With this change the above call for variants compiles and runs. Furthermore
the following code compiles and throws an exception.

v1 = poly;
v2 = pt;
within(v1, v2); // compiles but throws

Does someone have something against this change?


Geometry list run by mateusz at