On Thu, 4 Jan 2007 00:47:13 -0500, "Victor Bazarov" wrote:
>Parapura Rajkumar wrote:
>> int main(int argc, char* argv[])
>> {
>> std::map<int, int>::iterator footest;
>> {
>> std::map<int, int> foo;
>> foo[0] = 0;
>> footest = foo.begin();
>> }
>> return 0;
>> }
>>
>> Is this undefined behavior? Please note that footest is going out of
>> scope before std::map.
>
>You mean, "after 'foo'", don't you?
>
>> In theory an implementation could have a
>> iterator destructor that could still access the std::map ?
>
>No. The iterator is allowed to be invalid, that does not affect
>its destruction.
Different kinds of invalid iterators are described here:
http://www.angelikalanger.com/Confer...tions-2002.pdf
Best wishes,
Roland Pibinger