order of iterators in multi_index container
Hi I was using multi_index nicely and then I wondered that although iterators are not invalidated when calling replace or modify, could it be that if I'm modifying inside a loop then incrementing the iterator no longer makes it iterate through all elements because of the index reordering? Regards. -- Pedro Larroy Tovar Promax R&D Lab
Hello Pedro, boost@larroy.com ha escrito:
Hi
I was using multi_index nicely and then I wondered that although iterators are not invalidated when calling replace or modify, could it be that if I'm modifying inside a loop then incrementing the iterator no longer makes it iterate through all elements because of the index reordering?
Your concern is correct, modifying a range can be a tricky business due to the reordering of elements. Please take a look at the following discussion of the problem: http://lists.boost.org/boost-users/2006/03/18048.php which also provides some attached code you can try (look for jeff.cpp). Does this solve your problem? Thank you for using Boost.MultiIndex, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
On Fri, Jul 27, 2007 at 01:00:35PM +0200, Joaqu?n M? L?pez Mu?oz wrote:
Hello Pedro,
boost@larroy.com ha escrito:
Hi
I was using multi_index nicely and then I wondered that although iterators are not invalidated when calling replace or modify, could it be that if I'm modifying inside a loop then incrementing the iterator no longer makes it iterate through all elements because of the index reordering?
Your concern is correct, modifying a range can be a tricky business due to the reordering of elements. Please take a look at the following discussion of the problem:
http://lists.boost.org/boost-users/2006/03/18048.php
which also provides some attached code you can try (look for jeff.cpp). Does this solve your problem?
Yes, very mucho so. Perhaps it will be nice to have this in the docs.
Thank you for using Boost.MultiIndex,
Thank you for writting it and making it open source. Regards.
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Pedro Larroy Tovar, pedro at larroy dot com | http://pedro.larroy.com/ * Las patentes de programación son nocivas para la innovación * http://proinnova.hispalinux.es/
I'm using VC++ Express with Boost 1.34.0. Everytime I defined BOOST_PARAMETER_FUNCTION with >5 parameters I got this error: d:\project\basic\param\param.cpp(30) : error C2977: 'boost::parameter::parameters' : too many template arguments d:\library\boost\parameter\parameters.hpp(924) : see declaration of 'boost::parameter::parameters' d:\project\basic\param\param.cpp(30) : see reference to class template instantiation 'boost_param_params_30Func<BoostParameterDummy>' being compiled d:\project\basic\param\param.cpp(30) : error C2955: 'boost::parameter::parameters' : use of class template requires template argument list d:\library\boost\parameter\parameters.hpp(924) : see declaration of 'boost::parameter::parameters' d:\project\basic\param\param.cpp(30) : error C2977: 'boost::parameter::aux::argument_pack' : too many template arguments d:\library\boost\parameter\preprocessor.hpp(153) : see declaration of 'boost::parameter::aux::argument_pack' d:\project\basic\param\param.cpp(30) : error C2977: 'boost::parameter::aux::match' : too many template arguments d:\library\boost\parameter\preprocessor.hpp(97) : see declaration of 'boost::parameter::aux::match' d:\project\basic\param\param.cpp(30) : error C2039: 'type' : is not a member of 'boost::parameter::aux::match' d:\library\boost\parameter\preprocessor.hpp(97) : see declaration of 'boost::parameter::aux::match' d:\project\basic\param\param.cpp(30) : error C2146: syntax error : missing ',' before identifier 'boost_parameter_enabler_argument' d:\project\basic\param\param.cpp(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\project\basic\param\param.cpp(30) : error C2059: syntax error : ')' d:\project\basic\param\param.cpp(30) : error C2143: syntax error : missing ')' before '<end Parse>' My test code is this: int func(int , int , int , int , int , int ) { return 0; } BOOST_PARAMETER_NAME(arg1) BOOST_PARAMETER_NAME(arg2) BOOST_PARAMETER_NAME(arg3) BOOST_PARAMETER_NAME(arg4) BOOST_PARAMETER_NAME(arg5) BOOST_PARAMETER_NAME(arg6) BOOST_PARAMETER_NAME(arg7) BOOST_PARAMETER_NAME(arg8) BOOST_PARAMETER_FUNCTION( (int), Func, tag, (required(arg1,(int)) (arg2,(int)) (arg3,(int)) (arg4,(int)) (arg5,(int)) ) (optional(arg6,(int),0) ) ) { return func(arg1, arg2, arg3, arg4, arg5, arg6); } If I reduce the number of arguments in BOOST_PARAMETER_FUNCTION like this: BOOST_PARAMETER_FUNCTION( (int), Func, tag, (required(arg1,(int)) (arg2,(int)) (arg3,(int)) (arg4,(int)) ) (optional(arg6,(int),0) ) ) { return func(arg1, arg2, arg3, arg4, 0, arg6); } then it's compiled just fine. Any idea how to fix this ? --------------------------------- Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
--- Kamil Zubair wrote:
I'm using VC++ Express with Boost 1.34.0. Everytime I defined BOOST_PARAMETER_FUNCTION with >5 parameters I got this error:
You must #define BOOST_PARAMETER_MAX_ARITY to the maximum number of arguments that your Boost.Parameter-enabled functions will be passed in. The library will set it to 5 if you don't. HTH, Cromwell D. Enage ____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
Thanks for your info, btw where in documentation that mention this stuff ? I don't think it's mentioned in parameter docs.
Cromwell Enage
I'm using VC++ Express with Boost 1.34.0. Everytime I defined BOOST_PARAMETER_FUNCTION with >5 parameters I got this error:
You must #define BOOST_PARAMETER_MAX_ARITY to the maximum number of arguments that your Boost.Parameter-enabled functions will be passed in. The library will set it to 5 if you don't. HTH, Cromwell D. Enage ____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users --------------------------------- Got a little couch potato? Check out fun summer activities for kids.
--- Kamil Zubair wrote:
Thanks for your info, btw where in documentation that mention this stuff ? I don't think it's mentioned in parameter docs.
Section 7 near the bottom of the main page contains a link to the reference documentation: http://www.boost.org/libs/parameter/doc/html/reference.html HTH, Cromwell D. Enage ____________________________________________________________________________________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/
participants (4)
-
boost@larroy.com
-
Cromwell Enage
-
Joaquín Mª López Muñoz
-
Kamil Zubair