if we could parse this in compile-time we'd be able to
return proper type. Unfortunately AFAIK it's (currently?)
impossible to parse string literals in compile-time. If you
could proof me wrong I'd be very glad :). So I've implemented
some simplified version which can be found here:
https://github.com/awulkiew/test_boost_geometry_udl
Any ideas are welcome. It works like this:
using namespace bg::literals::cart2d;
"(1 1)"_pt; // point<double, 2, cs::cartesian>
"(0 0, 2 2)"_box; // box<p2d>
"(0 0, 1 1, 2 1)"_ls; // linestring<p2d>
// polygon<p2d> - for now the default cw closed, should probably be ccw
"((1 0, 1 3, 3 3, 3 0, 1 0))"_poly
// ring<p2d> - for now the default cw closed, should probably be ccw
// also non-WKT definition could be used - without doubled parentheses
"((1 0, 1 3, 3 3, 3 0, 1 0))"_ring
Of course you must compile it with some compiler supporting
user-defined literals, e.g. GCC >= 4.7 or Clang >= 3.1