Subject: Re: [boost] [iterator] UB when implicitly using default constructed counting_iterator<unsigned>
From: Peter Sommerlad (peter.sommerlad_at_[hidden])
Date: 2012-12-05 11:31:44
Just to clarify
A singular iterator can be safely compared with other iterators. It can not be dereferenced or incremented. A default constructed boost::counting_iterator<unsigned> can not safely be compared.
send from a mobile device.
Prof. Peter Sommerlad
+41-79-432 23 32
On 05.12.2012, at 17:19, "Claas H. KÃ¶hler" <claas.koehler_at_[hidden]> wrote:
> On 05/12/12 16:44, Olaf van der Spek wrote:
>> On Wed, Dec 5, 2012 at 2:40 PM, "Claas H. KÃ¶hler" <claas.koehler_at_[hidden]> wrote:
>>> I guess this also means, that it is possible to detect singular iterators even if they are
>>> initialised upon default construction.
>> Only if they've got special debug code and not if they're types like int.
> Correct. Basically this would require a boost equivalent of the safe_iterator (that's what its called
> in gcc), which could be used to wrap the boost iterators for debugging. Although this is not a
> trivial task, it seems preferable to me over leaving members uninitialised for the sake of (arguably)
> improved debugging capability.
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk