   array? or vector?
  I need an array of 512 bool values.  should i have a <vector> and just .reserve(512) or just declare a bool myarray[512];?   
  Well it depends on how you are going to use the memory. If you are going to want to move things around alot, make it a stack or queue, something like that, then use vector. But if you just want to store some arbitrary static data then use an array.Ofcourse the primary feature of a vector is the resizability of it, since you are using a fixed amount it might be cause for an array.Dave   ;  A std::bitset<512> is a space-efficient solution (without the overhead of the ugly boolean specialization of a dynamic vector). It does depend on what you actually want to do with however.   ;  Your could also try std::bitset.   ;  Definitely depends on how you're going to use it.  Actually, contrary to the beliefs of some, a vector will compile down so that it doesn't take up more space than an array, so you aren't really taking a performace hit if you use it right.  It really does depend on how you're using it, though, so more information would be good.   ;  well, i'm using SDL.  and when i Pollevent() i'm going to scroll through each event and (with my 512 bool values) make the key downs true and key ups false.   ;Quote:Original post by EvilKnuckles666well, i'm using SDL.  and when i Pollevent() i'm going to scroll through each event and (with my 512 bool values) make the key downs true and key ups false.Then performance doesn't appear to be an issue, and you don't have to do any serialization. A bitset seems like the cleanest solution.Of course you might as well use a boolean array or even a vector, it doesn't really matter.   ;  can someone post of code about using bitset?  i've never used or even heard of that b4.  i've always useing <vector> and <map>   ;class keymap { std::bitset<512> _map;public: void set(unsigned index, bool state) {  _map[index] = state; } bool get(unsigned index) const {  return _map[index]; }};Oh, and it's initialized to zero by default.As you can see it's not the hardest container in the world to use.   ;  oh wow, that's pretty simple.  and bitset is a bool right?  b/c i didn't set that being set so i'm assuming bitsets are bools?   