Home
C++ STL (Standard Template Library)
This page contains articles, tutorials, function, programs/examples in C++ STL (Standard Template Library).
Latest Articles, Tutorials, Examples on C++ STL
The STL (Standard Template Library) in C ++ is the collection of different algorithms and class templates. STL allows a programmer to implement the basic predefined data structures easily and effectively. STL basically provide us the data structure like stacks, lists and queues. Standard template library also allows a programmer to implement many algorithms directly using predefined functions.
C++ STL Basics
- Introduction to C++ STL (Standard Template Library)
- Range-based loop in C++ (similar to for-each loop)
- std::pair, std::tuple to return multiple values from a function
- std::nth_element() in C++
- Finding Median of an unsorted array in Linear Time using C++ standard library function
- std::valarray class in C++
- unordered_map in C++
C++ STL Algorithm header functions
- std::max() function with example in C++ STL
- std::min() function with example in C++ STL
- std::minmax() function with example in C++ STL
- std::min_element() function with example in C++ STL
- std::max_element() function with example in C++ STL
- std::copy() function with example in C++ STL
- std::copy_n() function with example in C++ STL
- std::copy_if() function with example in C++ STL
- std::count() function with example in C++ STL
- std::fill() function with example in C++ STL
- std::fill_n() function with example in C++ STL
- std::replace() function with example in C++ STL
- std::replace_if() function with example in C++ STL
- std::replace_copy() function with example in C++ STL
- std::replace_copy_if() function with example in C++ STL
- std::rotate() function with example in C++ STL
- std::rotate_copy() function with example in C++ STL
- std::accumulate() function with example in C++ STL
- Shuffling an array using C++ STL function
- std::binary_search() with examples in C++
- std::equal() with examples in C++
- std::for_each() with examples in C++
- std::find() with examples in C++
- std::find_first_of() with examples in C++
- std::includes() function with example in C++
- std::next_permutation() function with example in C++ STL
- std::lower_bound() function with example in C++ STL
- std::upper_bound() function with example in C++ STL
- std::swap_ranges() function with example in C++
C++ STL Utility header functions
- std::swap() function with example in C++ STL
C++ STL Arrays
- Array in C++ Standard Template Library (STL) with its common functions
- array::operator[] with Example in C++ STL
- array::front() function with Example in C++ STL
- array::back() function with Example in C++ STL
- array::begin() and array::end() functions with Example in C++ STL
- array::rbegin() and array::rend() functions with Example in C++ STL
- array::fill() function with Example in C++ STL
- array::size() function with Example in C++ STL
- array::max_size() function with Example in C++ STL
- array::empty() in C++ STL with Example
- array::get function template with Example in C++ STL
- Sort an array in ascending order using sort() function in C++ STL
- Sort an array in descending order using sort() function in C++ STL
- C++ program to find the integers which come odd number of times in an array
- C++ STL sort function to sort an array or vector
- How to get the first and last elements of an array in C++ STL?
C++ STL String
- std::string in C++ STL (Standard Template Library)
- String Assignment | C++ STL
- string::assign() Function with Example in C++ STL
- string::length() Function with Example in C++ STL
- Convert numeric to string using string::to_string() in C++ STL
- Appending text to the string using string::append() function in C++ STL
- Create substring by given start, end index of a string | C ++ STL
- Compare two string objects in C++ | C++ STL
- How to convert a character to string in C++ STL?
- How to convert an integer to string in C++ STL?
- More...
C++ STL List
- List functions in C++ STL (Standard Template Library)
- Assign the elements to the list (different methods) - Example of list::assign() | C++ STL
- std::list::empty() function in C++ STL
- Iterate a list (Example of list::begin() and list::end() functions) | C++ STL
- Iterate a list in reverse order (Example of list::rbegin() and list::rend() functions) | C++ STL
- Input and add elements to a list | C++ STL
- Get the first and last element of the list | C++ STL
- Insert the element at beginning and end of the list | C++ STL
- Remove all occurrences of an element and remove set of some specific from the list | C++ STL
- Examples of list.remove_if() function | C++ STL
- Remove all consecutive duplicate elements from the list | C++ STL
- Merge two lists using merge() function | C++ STL
- Creating a list by assigning the all elements of another list | C++ STL
- Assign a list with array elements | C++ STL
- Push characters in a list and print them separated by space in C++ STL
- Access elements of a characters list using const_iterator in C++ STL
C++ STL Stack
- Stack in C++ STL (Standard Template Library)
- stack::push() function in C++ STL
- stack::pop() function in C++ STL
- stack::top() function in C++ STL
- stack::size() function in C++ STL
- stack::empty() function in C++ STL
- Stack program using C++ Standard Template Library (STL)
C++ STL Set
- Set in C++ STL (Standard Template Library)
- set::size() function in C++ STL
- set::insert() function in C++ STL
- set::erase() function in C++ STL
- set::empty() function in C++ STL
- set::emplace() function in C++ STL
- set::clear() function in C++ STL
- set::lower_bound() function in C++ STL
- set::upper_bound() function in C++ STL
- set::find() function in C++ STL
- Converting String into Set in C++ STL
C++ STL Queue
- Queue in C++ Standard Template Library (STL)
- Print all elements of a queue in C++ STL
- queue::front() and queue::back() in C++ STL
- queue::push() and queue::pop() in C++ STL
- queue::empty() and queue::size() in C++ STL
- Check if a queue is empty or not using queue::size() function
C++ STL Deque
- Push and print elements in an integer deque in C++ STL
C++ STL Vector
- Vectors in C++ Standard Template Library (STL)
- Declare, Initialize and Access a Vector | C++ STL
- Initialize a vector in C++ in different ways
- Initialize 2D vector in C++ in different ways
- Passing vector to a function in C++
- Sort a 2D vector in C++
- Printing all elements of a vector using vector::begin() and vector::end() functions in C++ STL
- Printing all elements in reverse order of a vector using vector::begin() and vector::end() functions in C++ STL
- Create an empty vector and initialize by pushing values in C++ STL
- Create a vector by specifying the size and initialize elements with a default value in C++ STL
- Create a vector and initialize it like an array in C++ STL
- Create a vector and initialize it from an array in C++ STL
- Create a vector and initialize it from another vector in C++ STL
- Create and initialize a vector using different ways in C++ STL
- Access vector elements using for each loop in C++ STL
- Different ways to access elements from a Vector in C++ STL
- Push and print elements in an integer vector in C++ STL
- Push and print elements in a float vector in C++ STL
- Check vector is empty or not | C++ STL
- Copy a vector to another in C++
- Copy a vector to another by using vector.assign() function in C++
- Erase elements in C++ Vector using vector::erase()
- Find largest and smallest elements in a vector | C++ STL
- Insert elements in vector using vector::insert() | C++ STL
- C++ STL sort function to sort an array or vector
- Appending a vector to a vector in C++ STL
- Difference between size and capacity of a vector in C++ STL
- Minimum and maximum elements of a vector in C++ STL
- How to find the maximum/largest element of a vector in C++ STL?
- How to find the minimum/smallest element of a vector in C++ STL?
- How to reverse vector elements in C++ STL?
- How to find the sum of elements of a vector in C++ STL?
- How to join two vectors in C++ STL?
- How to find common elements between two Vectors using in C++ STL?
- How to copy array elements to a vector in C++ STL?
- Changing a particular element of a vector in C++ STL
- 2D vector in C++ STL with user defined size
- How to check whether an element exists in a vector in C++ STL?
- Different ways to copy a vector in C++
-
Vector Functions
C++ STL Map
- Map in C++ | C++ STL
- map::size() function in C++ STL with Example
- map::max_size() function with Example in C++ STL
- map::empty() function with Example in C++ STL
- Insert elements in map | C++ STL
- Delete elements from a Map | C++ STL
- C++ program to print all the Repeated Numbers with Frequency in an Array
- C++ program to print all the Non-repeated Numbers in an Array
- C++ STL | Sort a map based on values instead of keys
C++ STL Multimap
- Multimap in C++ STL
- Multimap insert(), erase() in C++ STL
- Multimap find(), lower_bound(), upper_bound() in C++ STL
C++ STL Priority Queue
- C++ STL | User-defined comparator for priority queue
C++ STL Heap
- Create Heap by using make_heap() | C++ STL
C++ STL MISC.
- Binary Search in C++ using Standard Template Library (STL) function binary_search()