awesome-cpp Latest commit uhub update Feb 7, 2025 c906828·Feb 7, 2025 History History A curated list of awesome C++ frameworks, libraries and software.
Time complexity Linear i.e. O(n) Example The following example shows the usage of std::map::map() constructor. Open Compiler #include <iostream> #include <map> using namespace std; int main(void) { /* Initializer_list constructor */ map<char, int> m1 = { {'a', 1}, {'b', 2...
The C++ STL Library C++ Library - <array> C++ Library - <bitset> C++ Library - <deque> C++ Library - <forward_list> C++ Library - <list> C++ Library - <map> C++ Library - <multimap> C++ Library - <queue> C++ Library - <priority_queue> C++ Library - <set> C++ Library - <stack...
Time complexityLinear i.e. O(n)ExampleThe following example shows the usage of std::stack::swap() function.Open Compiler #include <iostream> #include <stack> using namespace std; int main(void) { stack<int> s1; stack<int> s2; for (int i = 0; i < 5; ++i) s1.push(i + 1)...
Time complexityConstant i.e. O(1)ExampleThe following example shows the usage of std::list::push_back() function.Open Compiler #include <iostream> #include <list> using namespace std; int main(void) { list<int> l; for (int i = 0; i < 5; ++i) l.push_back(i + 1); cout <...
Time complexityThe time complexity of this function is Constant i.e. O(1)ExampleIn the following example, we are going to consider the basic usage of the shrink_to_fit() function.Open Compiler #include <iostream> #include <deque> int main() { std::deque<int> a; for (int x = 0; ...
The C++ STL Library C++ Library - <array> C++ Library - <bitset> C++ Library - <deque> C++ Library - <forward_list> C++ Library - <list> C++ Library - <map> C++ Library - <multimap> C++ Library - <queue> C++ Library - <priority_queue> C++ Library - <set> C++ Library - <stack...
Time complexity Linear i.e. O(n) Example The following example shows the usage of std::forward_list::swap() function. Open Compiler #include <iostream> #include <forward_list> using namespace std; int main(void) { forward_list<int> fl1 = {1, 2, 3, 4, 5};; forward_list<int> ...
The C++ STL Library C++ Library - <array> C++ Library - <bitset> C++ Library - <deque> C++ Library - <forward_list> C++ Library - <list> C++ Library - <map> C++ Library - <multimap> C++ Library - <queue> C++ Library - <priority_queue> C++ Library - <set> C++ Library - <stack...
The C++ STL Library C++ Library - <array> C++ Library - <bitset> C++ Library - <deque> C++ Library - <forward_list> C++ Library - <list> C++ Library - <map> C++ Library - <multimap> C++ Library - <queue> C++ Library - <priority_queue> C++ Library - <set> C++ Library - <stack...