This is an old revision of the document!
Rule of Three
Rule of Five
STL containers
The STL library has 3 types of container classes:
- sequence containers - container classes that maintain the ordering of elements in the container. Examples are vectors, deques, and lists.
- associative containers - container classes that automatically sort their inputs when the inputs are inserted into the container. Eg. are a set, multiset, map or multimap.
- container adapters - special predefined containers that are adapted to specific uses, such as a LIFO stack or a FIFO queue.
Map
An std::map is an associated array which is a map, symbol table or dictionary that has a collection of key value pairs such that a key only shows up once.
Memory Leaks
For every new there must be a delete. Use the following valgrind command to profile for mem leaks1):
valgrind --tool=memcheck --leak-check=yes name_of_exec