Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > efficiency of s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 45889 of 47032
Post > Topic >>

efficiency of std::vector for small arrays.

by Carter <cartercheng@[EMAIL PROTECTED] > May 12, 2008 at 06:58 PM

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.
 




 4 Posts in Topic:
efficiency of std::vector for small arrays.
Carter <cartercheng@[E  2008-05-12 18:58:12 
Re: efficiency of std::vector for small arrays.
"Victor Bazarov"  2008-05-12 23:57:02 
Re: efficiency of std::vector for small arrays.
Greg Herlihy <greghe@[  2008-05-12 21:39:38 
Re: efficiency of std::vector for small arrays.
Carter <cartercheng@[E  2008-05-13 08:30:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:55:59 CDT 2008.