C
Carter
I am currently writing some code where I have a list of objects with a
maximum occupancy of 4. I have been employing std::vector for this but
I was wondering how much overhead is involved. Is it better to use
some other data structure if speed is critical i.e. maybe a struct
like this-
template <typename T>
struct max_four
{
int element_count;
T elements[4];
};
Or are std::vectors/lists reasonably competitive in both space/time?
Thanks in advance,
Carter.
maximum occupancy of 4. I have been employing std::vector for this but
I was wondering how much overhead is involved. Is it better to use
some other data structure if speed is critical i.e. maybe a struct
like this-
template <typename T>
struct max_four
{
int element_count;
T elements[4];
};
Or are std::vectors/lists reasonably competitive in both space/time?
Thanks in advance,
Carter.