Re: [Cppcms-users] std::vector in coding standarts
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-11-16 11:21:20
|
> > Hello Artyom! > > May be it's not so significant, but i think it's necessary to discuss. > > At http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_coding_standards you >wrote that "Always prefer std::vector to std::list - it has better performance >because it is cache friendly." > But imho, doing so can lead to performance troubles in some cases: for >example, if you try to remove an item from the middle of multimillion >std::vector - unlike std::list. > > --- > Regards, kpeo Of course not in case you want to do something like that. The coding standard is advice, not "always use it" so for example if I do need to insert items and remove items from list randomly I use std::list, for example cache where std::list is used for LRU handling. Artyom |