C and C++ Programming Resources | C & C++ Code Example Index

 

 

 

 

The C++ Standard Template Library (STL) Sample Codes Index Page

 

The following links provide the C++ program examples on the standard C++ template library (STL). STL is the C++ generic or template based programming and the sample codes include the basic of template in C++ (function and class templates), containers, iterators, algorithms, character and string template library and function object (functor). The containers include vector, deque, list, set, multiset, map, multimap, hash_map, hash_multimap, hash_set, hash_multiset and the container adaptors include stack, queue and priority_queue. The total number of code examples are 200++.

 

C++ Standard Template Library (STL) Code Samples

  1. A very simple C++ function template program example

  2. A normal C++ class with function template code example

  3. A very simple C++ class template working program example

  4. The C++ class template packaging program example

  5. The C++ implicit class template instantiation program example

  6. The C++ explicit class template instantiation program example

  7. Another C++ implicit class template instantiation code example

  8. Another C++ class template explicit instantiation code example

  9. Another implicit C++ class template instantiation program example

  10. A very simple C++ class template specialization program example

  11. The C++ class template specialization code example

  12. The C++ class template specialization and partial specialization

  13. Another C++ class template specialization program example

  14. A very simple C++ vector container program example

  15. C++ STL vector, various operators code example

  16. C++ STL vector, assign() program example

  17. C++ STL vector, at() code example

  18. C++ STL vector, back() and front() code example

  19. C++ STL vector, begin() code example

  20. C++ STL vector, capacity() and size() code example

  21. C++ STL vector, clear(), empty() and size() code example

  22. C++ STL vector, begin() and end() code example

  23. C++ STL vector, erase(), begin() and end() code example

  24. C++ STL vector, insert(), begin() and end() code example

  25. C++ STL vector, max_size() code example

  26. C++ STL vector, pop_back(), back() and push_back() code example

  27. C++ STL vector, constructors code example

  28. C++ STL vector, rbegin() code example

  29. C++ STL vector, rend() and rbegin() code example

  30. C++ STL vector, resize() and size() code example

  31. C++ STL vector, reserve(), capacity() and size() code example

  32. C++ STL vector, swap() code example

  33. C++ STL vector operator[ ] code example

  34. C++ STL vector_bool, flip() code example

  35. C++ STL vector_bool, swap() code example

  36. C++ STL, a very simple deque code example

  37. C++ STL deque, constructors code example

  38. C++ STL deque, rbegin() code example

  39. C++ STL deque, insert() program example

  40. C++ STL, the list program example

  41. C++ STL list, constructors program example

  42. C++ STL list, assign() code example

  43. C++ STL list, remove_if() code example

  44. C++ STL list, pop_back(), pop_front(), push_back() and push_front() code example

  45. C++ STL list, insert() code example

  46. C++ STL list, remove() code example

  47. C++ STL list, sort() code example

  48. C++ STL list, splice() code example

  49. C++ STL list, unique() code example

  50. C++ STL set, constructor code example

  51. C++ STL set, count() code example

  52. C++ STL set, equal_range() code example

  53. C++ STL set, key_comp() code example

  54. C++ STL set, lower_bound() program example

  55. C++ STL set, upper_bound() program example

  56. C++ STL set, value_comp() program example

  57. C++ STL multiset, constructors program example

  58. C++ STL multiset, find() program example

  59. C++ STL list, merge() program example

  60. C++ STL map, constructors program example

  61. C++ STL map, value_comp() program sample

  62. C++ STL map, rbegin() program example

  63. C++ STL multimap, constructor or ctor program example

  64. C++ STL multimap, key_compare program example

  65. C++ STL hash_map, constructor program example

  66. C++ STL hash_map, operator!= program example

  67. C++ STL hash_map, operator>= program example

  68. C++ STL hash_multimap, constructor program example

  69. C++ STL hash_set, constructor program example

  70. C++ STL hash_multiset, constructor program example

  71. C++ STL stack, pop(), push(), size() and top() program example

  72. C++ STL stack, operator!= program example

  73. C++ STL  stack, another constructor program example

  74. C++ STL queue, back(), push() and front() program example

  75. C++ STL  deque, constructor program example

  76. C++ STL  queue, constructor program example

  77. C++ STL  deque, swap() program example

  78. C++ STL  deque, back() program example

  79. C++ STL  deque, assign() program example

  80. C++ STL  queue, the push() program example

  81. C++ STL  queue, pop() program example

  82. C++ STL  queue, front() program example

  83. C++ STL  iterator, traverse the set container with begin() and end() program example

  84. C++ STL  iterator, a very simple list program example using begin() and end()

  85. C++ STL  queue, empty() program example

  86. C++ STL  iterator, traverse the multimap container with begin() and end() program example

  87. C++ STL  iterator, traverse the map container with begin() and end() program example

  88. C++ STL  iterator, traverse the multiset container with begin() and end() program example

  89. C++ STL  iterator, distance() program example

  90. C++ STL  iterator, back_inserter() program example

  91. C++ STL  iterator, traverse the container using advance() program example

  92. C++ STL iterator, operator!= program example

  93. C++ STL  iterator, inserter() program example

 

  1. C++ STL  iterator, front_inserter() program example

  2. C++ STL  iterator, operator<= program example

  3. C++ STL iterator, operator< program example

  4. C++ STL iterator, operator== program example

  5. C++ STL  iterator, operator+ add program example

  6. C++ STL  iterator, operator>= program example

  7. C++ STL  iterator, operator> code example

  8. C++ STL  insert_iterator::container_type code example

  9. C++ STL  iterator, a template class program example

  10. C++ STL  iterator, iterator_traits class for vector and list program example

  11. C++ STL  iterator, operator- minus program example

  12. C++ STL  insert_iterator::operator* program example

  13. C++ STL  insert_iterator::insert_iterator program sample

  1. C++ STL  insert_iterator::reference program example

  2. C++ STL hash_map::begin() iterator program example

  3. C++ STL  basic_string::begin() iterator program example

  4. C++ STL back_insert_iterator::back_insert_iterator program example

  5. C++ STL checked_array_iterator class program sample

  6. C++ STL hash_multimap::begin() iterator program example

  7. C++ STL insert_iterator::operator=, the assignment operator program example

  8. C++ STL insert_iterator::operator++, the increment operator program example

  9. C++ STL iterator_traits::random_access_iterator_tag class program example

  10. C++ STL istreambuf_iterator::equal() program example

  11. C++ STL istreambuf_iterator::int_type code sample

  12. C++ STL istreambuf_iterator::char_type program sample

  13. C++ STL istream_iterator::istream_iterator code example

  14. C++ STL istream_iterator, char_type and traits_type program example

  15. C++ STL istreambuf_iterator::istreambuf_iterator program example

  16. C++ STL istreambuf_iterator::operator++, increment program example

  17. C++ STL ostream_iterator::ostream_iterator program sample

  18. C++ STL ostream_iterator::operator= assignment program example

  19. C++ STL C++ STL ostreambuf_iterator::ostreambuf_iterator program example

  20. C++ STL ostreambuf_iterator::failed() program example

  21. C++ STL reverse_iterator::operator[ ] program example

  22. C++ STL reverse_iterator::base() program example

  23. C++ STL inserter iterators: back_inserter(), front_inserter() and inserter() program example

  24. C++ STL stream iterator program example

  25. C++ STL reverse iterator using rbegin() and rend() program example

  26. C++ STL : A very simple algorithm code example

  27. C++ STL algorithm, insert(), copy(), display() and resize() program example

  28. C++ STL algorithm, finding a prime number program example

  29. C++ STL reverse_iterator, a pointer program sample

  30. C++ STL algorithm, adjacent_find() program example

  31. C++ STL algorithm, binary_search(), mod_lesser(), pushback() and, sort() program example

  32. C++ STL algorithm, copy() code example

  33. C++ STL algorithm, copy_backward() program sample

  34. C++ STL algorithm, count() program example

  35. C++ STL algorithm, count_if() program example

  36. C++ STL algorithm, count_if(), begin() and end() program example

  37. C++ STL algorithm, equal() program example

  38. C++ STL algorithm, equal_range() program example

  39. C++ STL algorithm, fill() program example

  40. C++ STL algorithm, fill_n() program sample

  41. C++ STL algorithm, find() program example

  42. C++ STL algorithm, find_end() program sample

  43. C++ STL algorithm, find_first_of() code example

  44. C++ STL algorithm, find_if() program example

  45. C++ STL algorithm, for_each() code example

  46. C++ STL algorithm, generate() program  example

  47. C++ STL algorithm, generate_n() program example

  48. C++ STL algorithm, includes() code example

  49. C++ STL algorithm, inplace_merge() program example

  50. C++ STL algorithm, iter_swap() program sample

  51. C++ STL algorithm, lexicographical_compare() code example

  52. C++ STL algorithm, lower_bound() program example

  53. C++ STL algorithm, make_heap() program example

  54. C++ STL algorithm, max() code example

  55. C++ STL algorithm, max_element() code sample

  56. C++ STL algorithm, merge() program example

  57. C++ STL algorithm, min() program example

  58. C++ STL algorithm, min_element() code sample

  59. C++ STL algorithm, mismatch() program example

  60. C++ STL algorithm, next_permutation() program sample

  61. C++ STL algorithm, nth_element() code sample

  62. C++ STL algorithm, partial_sort() program example

  63. C++ STL algorithm, partial_sort_copy() program example

  64. C++ STL algorithm, partition() program example

  65. C++ STL algorithm, pop_heap() code example

  66. C++ STL algorithm, prev_permutation() program sample

  67. C++ STL algorithm, replace() code sample

  68. C++ STL algorithm, replace_copy() program example

  69. C++ STL algorithm, replace_copy_if() code sample

  70. C++ STL algorithm, rotate() code example

  71. C++ STL algorithm, search() program example

  72. C++ STL algorithm, search_n() code example

  73. C++ STL algorithm, make_heap(), push_heap(), sort_heap() and pop_heap() program example

  74. C++ STL algorithm, sort() program example

  75. C++ STL algorithm, make_heap() and push_heap() code example

  76. C++ STL algorithm, make_heap() and push_heap() program example

  77. C++ STL algorithm, another remove() code example

  78. C++ STL algorithm, random_shuffle() program example

  79. C++ STL algorithm, remove() code example

  80. C++ STL algorithm, remove_copy() program example

  81. C++ STL algorithm, remove_copy_if() program example

  82. C++ STL algorithm, remove_if() code example

  83. C++ STL algorithm, another replace() program example

  84. C++ STL algorithm, replace_copy() code sample

  85. C++ STL algorithm, replace_copy_if() program sample

  86. C++ STL algorithm, replace_if() program example

  87. C++ STL algorithm, reverse() code example

  88. C++ STL algorithm, reverse_copy() program example

  89. C++ STL algorithm, rotate() program example

  90. C++ STL algorithm, rotate_copy(), string code example

  91. C++ STL algorithm, rotate_copy(), integer program example

  92. C++ STL algorithm, another search() program example

  93. C++ STL algorithm, search_n() code example

  94. C++ STL algorithm, set_difference() code sample

  95. C++ STL algorithm, set_intersection() program example

  96. C++ STL algorithm, set_symmetric_difference() program example

  97. C++ STL algorithm, random_shuffle() and sort() program example

  98. C++ STL algorithm, sort_heap() code example

  99. C++ STL algorithm, stable_partition() program example

  100. C++ STL algorithm, stable_sort() program example

  101. C++ STL algorithm, swap() code example

  102. C++ STL algorithm, swap_ranges() code example

  103. C++ STL algorithm, transform() code sample

  104. C++ STL algorithm unique() program example

  105. C++ STL algorithm unique_copy() program example

  106. C++ STL, algorithm upper_bound() program example

  107. C++ STL iterator, checked iterators program sample

  108. C++ algorithm unchecked_copy() version program example

  109. C++ algorithm checked_copy() version code example

  110. C++ STL algorithm set_union() member program sample

  111. The C++ STL function object, functor code sample

  112. Another C++ STL function object program example

  113. C++ STL priority_queue constructor program example

  114. C++ STL priority_queue, push(), pop(), top(), empty() and size() program example

 

C and C++ Programming Resources | C & C++ Code Example Index | C Code Example Index