|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
STL container question Hello I need to store a number of integer values which I will then search on later to see if they exist in my container. Can someone tell me which container would be quickest for finding these values? I can't use a plain C array (unless I make it 2^32 in size!) since I don't know the max integer value. |
#2
| |||
| |||
Re: STL container question For that case, I think std::list is a better option, since the sorting will be faster Lists are implemented using pointers to point to the previous and to the next elements, so list::sort(), is more efficient by changing pointer values, while sorting a vector involves copying objects. |
#3
| |||
| |||
Re: STL container question The original poster talked about storing integer values. I highly doubt sorting a list of integers will be faster than sorting an array of integers. In fact, I'm pretty sure of the contrary. |
#4
| |||
| |||
Re: STL container question And you really think that doing two pointer exchanges is faster than one integer exchange? However, it can still be slower, since it's more or less the worst thing you can do to the cache. |
#5
| |||
| |||
Re: STL container question Still, you should only get one cache-miss when looking for a value, if you use a set or vector you will probably get more. |
![]() |
|
Tags: container, stl |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
.mov file container | Rufta | Windows Software | 3 | 25-12-2010 03:27 PM |
Need a .MOV File container | VAIJAYI | Windows Software | 3 | 25-12-2010 04:08 AM |
The list container of the C++ | BossBattle | Software Development | 5 | 27-02-2010 08:39 PM |
What is Servlet container? | Sonam Goenka | Software Development | 5 | 05-02-2010 08:13 AM |
How to create DB2 9.5 container | Pollock | Windows Software | 3 | 12-08-2009 11:57 AM |