STL (Standard Template Library) === Topics ------ * Iterators * Auto Pointers * Vector Container * List Container * Deque Container * Queue Container * Stack * Queue STL Declaration - "using namespace std" Note: Using namespace specific declarations such as "using std::string" is not backwards competible between VC7 and VC6. Iterators iter_name++; iter_name--; - goes to next/previous element and returns the prevoius position (SLOW) ++iter_name; --iter_name; - goes to next/previous element and returns the next position (FAST) Auto Pointers auto_ptr ptr (new T()); - use them to prevent memory leaks - especially when using exceptions (regular pointers aren't destroyed). when pointer assigned to auto_ptr an ownership transfer occure (the original pointer will point to NULL). same happens when passing auto_ptr by value - the original pointer will point nowhere. only when passing auto_ptr by reference there will be no ownership transfer. Vector Container #include vector vec; - Vectors are a kind of sequence containers. Individual elements can be accessed by their position index. Elements are ordered following a strict linear sequence. Storage in vectors is handled automatically, allowing it to be expanded and contracted as needed. Optimized for sequential read and write operations. Elements can be added at the end. List Container #include list lst; - Lists are a kind of sequence containers. Implemented as doubly-linked lists. Optimized for adding and removing elements anywhere in the container. Efficient moving elements within the container. No direct access to the elements by their position. Deque Container #include deque deq; - Double-ended queues. A kind of sequence containers. Same as vector but optimized for front-end and back-end operations. Queue Container #include queue que; - Container adaptors, specifically designed to operate in a FIFO context (first-in first-out). Stack #include stack stack_name; - A wrapper for the containers (simplifies functionality). has a LIFO structure. \ / / \ \_______________________________________/ /dANIEL - http://thedump.fortunecity.com\ \_______________________________________/ / \ \ / / \