|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-03-02 09:23:36
Tom Widmer <tom_usenet_at_[hidden]> writes:
>>If I'm misusing the code, is there some reason for this? It's
>>inconvenient that the default constructor doesn't initialize pointers
>>to some consistent value; the problem goes away when I change the
>>indirect_iterator default constructor:
>>
>> 94c94,96
>> < indirect_iterator() {}
>> ---
>> > indirect_iterator()
>> > : super_t( Iterator() )
>> > {}
>
> That gives you a false sense of safety. Default initializing many
> iterator types is a no-op - they are still unusable (e.g.
> std::list::iterator).
or, in the same way, int*.
Tom's right. You don't have a right to expect very much from a
default-constructed iterator. You can't even copy it without inducing
undefined behavior.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk