Just come up with this question. Any hint?
C can't have an "exact equivalent" of STL because C doesn't have templates or classes. You might be interested in the "Glib collections" library: http://www.ibm.com/developerworks/linux/tutorials/l-glib/
Associative containers implement sorted data structures that can be quickly searched (O(log n) complexity).
The three types of containers found in the STL are sequential, associative and unordered.
The STL containers std::vector , std::deque , and std::list all meet these requirements and can be used for underlying storage. The standard container adapters are: stack provides an LIFO data structure. queue provides a FIFO data structure.
classes that can't be copied. STL containers require objects to be copyable since the container owns a copy of that object, and needs to be able to move it around.
My favourite thing not to put into a STL container is an std::auto_ptr... very bad things happen. .. mostly unexpected loss of objects I think.
In general anything that is not copyable can't go into a container - you'll get compile errors. Something with abnormal copy semantics (like auto_ptr) should not go in a container (but you probably wont get any compiler errors). As the container is free to create various temporary copies.
I think that without a "sane" default constructor and assignment operator you are also in for some pain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With