$include_dir="/home/hyper-archives/geometry/include"; include("$include_dir/msg-header.inc") ?>
Subject: [ggl] pre-/post-increment op on iterators
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-04-28 09:53:46
Hi,
>
>>> Yes, I found it convenient too.
>>> However, I can understand the rationale behind BOOST_FOREACH.
>>> Even if it does require explicit use of value_type, on the other
>>> hand it frees you from knowledge about how container/collection is
>>> being iterated. Iteration is hidden as it is by algorithms.
>>> Second, if functor introduces extra entities into code,
>>> and in some cases it may make code less readable/understandable.
>>> BOOST_FOREACH is handy as replacement for simple loop, plus it
>>> provides nice genericness.
>>
>> Yep, all approaches have their drawbacks and advantages, indeed. So I
>> don't really bother if somebody uses one or the other,
>
> Same here.
>
>> I simply wait
>> for the concept-based C++0x for_each that will solve everything :-)
>
> :-)
OK, nice. So let's just wait, good idea, and until then use normal
pre-increment in loops.
Many of our loops are on segments anyway, the BOOST_FOREACH will not
work there.
A related question, I've created some iterators recently and it would be
convenient to have an interator on a vector which has a segment as its
valuetype. Didn't work it out and don't know if it is possible at all,
do you think it makes sense here?
Regards, Barend