Hi,
Say you have a program that stores a bunch of time values, which are in seconds. They can either be to the nearest full second, or can end in .5. So for example, the first few would be: 0, 0.5, 1, 1.5, 2, and so on.
Say you want to remember when a number of events happen. Like if something happens at 4, 4.5, 7, 12, and 15.5 seconds. What would be a good way to store the series of times?
Right now I'm using a std::vector of type <double>. I'm guessing this is probably not the best way to do it because it uses up more memory than it should. I should also note here that I don't need to store negative values, and the maximum time I would need to go upto would be about 2 hours.
I was thinking I could use an unsigned float. Alternately, because I only need to store either a full number or 0.5, maybe an unsigned short int and convert it whenever I use it or something. What do you guys think? Also is std::vector a good choice for the container?
Thanks for your help.