On Dec 18, 5:44 pm, anon <a...@no.no> wrote:
Sarath wrote:
I've two vectors vectorA and vectorB.
I've copy some elements from vectorA to B on satisfying some
conditions. I'd like to avoid for loop and comparison routines. It
would appreciate if there are any stl routines/classes can help on
this matter. I tried using for_each but still passing elements still a
problem.
e.g
stuct Test
{
char name[20];
int nCategory;
}
void Filter( const vector<Test>& vecA, vector<Test>& vecB, char*
pFilter)
{
// compare "name" attribute with "pFilter" and copy on success
}
Would this help:http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/rem_9276.htm
?- Hide quoted text -
- Show quoted text -
Thanks for your reply.
remove_copy_if will do the work but in my case the destiation size is
not predefined. the container should initialize with some size. seems
it doesn't increase the size of destination container.
In my case the input size will be large enough so I can't say the
exact size of destination container. If I "reserve" the same size of
input vector, it will create some performance hitch I believe.
.