[C++-sig] Re: iterator interface question (progress!)
David Abrahams
dave at boost-consulting.com
Sun Feb 1 03:22:10 CET 2004
Neal Becker <ndbecker at verizon.net> writes:
>> Better make begin and end functions use return_internal_reference, so
>> the iterators won't outlive the container. UNfortunately, they're
>> still not safe since they can still run off the end of the vector or
>> become invalidated. These are the sorts of issues that the indexing
>> suites should handle.
>>
>
> Thanks for the help, but I still have 1 question about your reply (the
> meaning of "should"). Do you mean the indexing suites already do provide a
> better solution (and I should look at it) or do you mean that you wish the
> indexing suites provided a better solution, and may in the future?
I mean that they already do provide better solutions. That said, they
don't expose a C++ iterator idiom; they expose a Python iterator
idiom. It's generally accepted that C++ code wrapped in Python should
behave Pythonically. Python users probably won't understand your
crazy begin()/end() interface ;-)
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list