Harry Overs wrote:
Hi,
what is the easiest way to copy a STL list of BYTEs to a new list that will
then be used and maintained by an external class? The list that is to be
copied is very large about 25000 so the I need a very efficient solution.
(assuming typedef char BYTE)
std::list<BYTE> is not exactly the most efficient way to store bytes and
25000 bytes is really quite small on some more modern systems.
I would probably just use list::size() to find the size, allocate a
vector or array (whatever is needed) and use std::copy or std::copy_n.
If the performance was not good enough, I'd do a profile and figure out
what was using the the cpu and fix that. Doing anything else right now
is speculative.