M
Matthias Kaeppler
Hi,
in my program, I have to sort containers of objects which can be 2000
items big in some cases. Since STL containers are based around copying
and since I need to sort these containers quite frequently, I thought
it'd be a better idea to manage additional containers which are
initialized with pointers to the objects in the primary containers and
sort those (only pointers have to be copied around then).
However, that also means if I have 2000 objects, I have to create *two*
containers holding 2000 objects each, the first with the real objects
and the second with pointers to those.
My question is:
If those objects I'm talking about are between 8 and 16 bytes, would it
be faster to simply perform the sort algos on the objects themselves or
is it better to create that additional container with pointers and
continue working with that?
in my program, I have to sort containers of objects which can be 2000
items big in some cases. Since STL containers are based around copying
and since I need to sort these containers quite frequently, I thought
it'd be a better idea to manage additional containers which are
initialized with pointers to the objects in the primary containers and
sort those (only pointers have to be copied around then).
However, that also means if I have 2000 objects, I have to create *two*
containers holding 2000 objects each, the first with the real objects
and the second with pointers to those.
My question is:
If those objects I'm talking about are between 8 and 16 bytes, would it
be faster to simply perform the sort algos on the objects themselves or
is it better to create that additional container with pointers and
continue working with that?