📘 Lesson  ·  Lesson 74

STL Overview

STL Overview

What is the STL?

💡 Note

The STL (Standard Template Library) provides ready-made containers (vector, map, set), algorithms (sort, find) and iterators.

Main Parts

  • Containers — vector, list, map, set, stack, queue.
  • Algorithms — sort, find, count, reverse.
  • Iterators — move through containers.

Example

C++
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> v = {5, 2, 8, 1};
    sort(v.begin(), v.end());   // STL algorithm
    for (int x : v) cout << x << " ";   // 1 2 5 8
    return 0;
}
Output:
1 2 5 8

Summary

  • STL = containers + algorithms + iterators, ready to use.
  • Saves time vs writing data structures from scratch.

the STL क्या है?

💡 Note

The STL (Standard Template Library) provides ready-made containers (vector, map, set), algorithms (sort, find) and iterators.

Main Parts

  • Containers — vector, list, map, set, stack, queue.
  • Algorithms — sort, find, count, reverse.
  • Iterators — move through containers.

Example

C++
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> v = {5, 2, 8, 1};
    sort(v.begin(), v.end());   // STL algorithm
    for (int x : v) cout << x << " ";   // 1 2 5 8
    return 0;
}
Output:
1 2 5 8

सारांश

  • STL = containers + algorithms + iterators, ready to use.
  • Saves time vs writing data structures from scratch.
← Back to C++ Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n

💻 Live Code Editor

Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें. Agar load na ho to naye tab mein kholें.