STL ka full form hota hai Standard Template Library.

Ye C++ ki ek powerful library hai jo ready-made data structures aur algorithms provide karti hai, jaise:


🔹 STL ke Main Components:

Part Explanation
1. Containers Data ko store karne ke liye use hote hain (e.g., vector, list, set, map)
2. Algorithms Data par operations perform karte hain (e.g., sort(), binary_search(), count())
3. Iterators Containers ke elements ko access karne ke liye use hote hain (like pointers)

🔹 Common Containers:

Container Description
vector Dynamic array
list Doubly linked list
deque Double-ended queue
stack LIFO (Last In First Out)
queue FIFO (First In First Out)
priority_queue Max/Min Heap
set Unique sorted elements
map Key-value pairs (like dictionary)
unordered_set/map Fast lookup, no order

🔹 STL ka Use Kyu Karte Hai?

✅ Time bachata hai (no need to write your own data structures)

✅ Code clean & maintainable hota hai

✅ Efficient & well-tested functions hoti hain


🔹 Example:


#include <iostream>
#include <vector>
#include <algorithm> // for sort

using namespace std;

int main() {
    vector<int> v = {5, 3, 8, 1};

    sort(v.begin(), v.end());  // STL sort function

    for(int x : v) {
        cout << x << " ";
    }

    return 0;
}