Subject: [geometry] Support of C++11 initializer list
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2015-01-23 21:36:52


Hi,

Some time ago I added an experimental support for C++ initializer lists in
geometries to make possible the creation of geometries using uniform
initialization, e.g.:

linestring ls = {{0, 0},{1, 1},{2, 2}};
polygon poly = {{{0, 0},{0, 5},{5, 5},{5, 0},{0, 0}},{{1, 1},{4, 1},{4,
4},{1, 4},{1, 1}}};

The goal was to support C++11 initializer lists and Boost.Assign in the
same time even if Boost.Assign currently doesn't work on all compilers with
STL containers. FYI, there is a PR with proposed fix but nobody is willing
to merge it.

Anyway, to work around it and avoid ambiguity while using Boost.Assign to
assign new data to the geometry I implemented only the constructor taking
std::initializer_list. This way the compiler prefers the conversion from
Boost.Assign generic_list directly into the Geometry because conversion
first to std::initializer_list would require 1 more conversion.

It seems that everything is ok on all compilers except the msvc14 CTP, I
hope they'll fix it in the final release. See
http://www.boost.org/development/tests/develop/developer/geometry.html, the
test geometries.

So if you'd like to try it out you have to checkout the develop branch and
define BOOST_GEOMETRY_EXPERIMENTAL_ENABLE_INITIALIZER_LIST. Please let me
know if it works for you.

The final question is, should we enable it by default in Boost 1.58?

Regards,
Adam