Boost logo

Geometry :

Subject: Re: [geometry] Boost.Geometry models initializer_lists
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2014-02-26 20:05:29


Hi,

Barend Gehrels wrote:
>>
>> Do you think that the support for C++11 initializer_list is needed
>> (and sufficient). It would probably look like this:
>>
>> polygon_type polygon{ {{0, 0},{0, 10},{10, 10},{10, 0},{0, 0}} ,
>> {{1, 1},{2, 1},{2, 2},{1, 2},{1, 1}}};
>>
>> or that we should also provide a chaining tool working in C++98?
>> Which could look like this:
>>
>> polygon_type polygon = make_geometry<polygon_type>(
>> make_geometry<ring_type>(0, 0)(0, 10)(10, 10)(10, 0)(0, 0) )
>> (
>> make_geometry<ring_type>(1, 1)(2, 1)(2, 2)(1, 2)(1, 1) );
>>
>>
>
> This looks very good, I like this very much. The C++11 too (but I
> don't yet use that).
>
> Though I like it very much I still doubt if there is wide need for it...
> But maybe indeed in some of our own unit tests.
>

Ok, so I propose to add only the support for the initializer_list.

>
>>
>> polygon_type polygon = make_geometry<polygon_type>(0, 0)(0, 10)(10,
>> 10)(10, 0)(0, 0) ,
>> (1, 1)(2, 1)(2, 2)(1, 2)(1, 1);
>
> With comma operator, hmm, don't know yet. I think we get into problems
> with multi-polygons (having inner rings too) then? That comma-operator
> also has nasty side effects w.r.t. preference IIRC (e.g. use it in a
> ternary-operator...).

Yes, you're right. I didn't thought about MultiPolygon.

Regards,
Adam



Geometry list run by mateusz at loskot.net