What is the Standard Template Library (STL)? Name some commonly used containers.
Show answer and explanation
The STL is the generic-programming foundation of the C++ standard library built around containers, iterators, algorithms, and function objects. Common sequence containers include vector, array, deque, list, and forward_list; ordered associative containers include map and set; unordered variants are hash based; and adaptors include stack, queue, and priority_queue. Container choice should follow access pattern, invalidation rules, ordering, and complexity needs rather than habit.
The STL is the generic-programming foundation of the C++ standard library built around containers, iterators, algorithms, and function objects. Common sequence containers include vector, array, deque, list, and forward_list; ordered associative containers include map and set; unordered variants are hash based; and adaptors include stack, queue, and priority_queue. Container choice should follow access pattern, invalidation rules, ordering, and complexity needs rather than habit.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.