[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [./src/input.cc:1268]: (error) Dangerous iterator usage.
From: |
CdeMills |
Subject: |
Re: [./src/input.cc:1268]: (error) Dangerous iterator usage. |
Date: |
Thu, 27 Jan 2011 01:22:22 -0800 (PST) |
John W. Eaton wrote:
>
>
> --- a/src/input.cc
> +++ b/src/input.cc
> @@ -1255,7 +1255,7 @@
> std::string hook_fcn = p->first;
> octave_value user_data = p->second;
>
> - p++;
> + hook_fcn_map_type::iterator q = p++;
>
> if (is_valid_function (hook_fcn))
> {
> @@ -1265,7 +1265,7 @@
> feval (hook_fcn, octave_value_list (), 0);
> }
> else
> - hook_fcn_map.erase (p);
> + hook_fcn_map.erase (q);
> }
>
> if (hook_fcn_map.empty ())
>
>
I modified my small test program to work the same way as you did the
modification. Removing the element before the last or the last one succeed.
Should be OK.
Regards
Pascal
http://octave.1599824.n4.nabble.com/file/n3241717/testmap.cpp testmap.cpp
--
View this message in context:
http://octave.1599824.n4.nabble.com/src-input-cc-1268-error-Dangerous-iterator-usage-tp3241656p3241717.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.