![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++STL(Standard Template Library)
文章平均质量分 91
Jacy_CSer
南京大学计算机科学与技术系
展开
-
STL-01 Introduction of `STL` -- Standard Template Library
1 Introduction of STL – Standard Template Library1.1 General DescriptionThe Standard Template Library (STL) is a set of C++ template classes to provide common programming data structures and functions such as lists, stacks, arrays, etc. It is a library o原创 2021-04-01 16:11:43 · 245 阅读 · 0 评论 -
STL-28 Pair in C++ Standard Template Library (STL)
Pair in C++ Standard Template Library (STL)The pair container is a simple container defined in <utility> header consisting of two data elements or objects.The first element is referenced as ‘first’ and the second element as ‘second’ and the order原创 2021-04-03 00:02:07 · 150 阅读 · 0 评论 -
STL-27 Iterators in C++ STL
Iterators in C++ STLIterators are used to point at the memory addresses of STL containers. They are primarily used in sequence of numbers, characters etc. They reduce the complexity and execution time of program.Operations of iterators:begin():- This原创 2021-04-03 00:01:57 · 117 阅读 · 0 评论 -
STL-26 Introduction to Iterators in C++
Introduction to Iterators in C++An iterator is an object (like a pointer) that points to an element inside the container. We can use iterators to move through the contents of the container. They can be visualized as something similar to a pointer pointing原创 2021-04-03 00:01:47 · 147 阅读 · 0 评论 -
STL-25 Functors in C++
Functors in C++Please note that the title is Functors (Not Functions)!!Consider a function that takes only one argument. However, while calling this function we have a lot more information that we would like to pass to this function, but we cannot as it原创 2021-04-03 00:01:32 · 119 阅读 · 0 评论 -
STL-24 unordered_multimap and its application(Introduced in C++11)
unordered_multimap and its application(Introduced in C++11)Allows Duplicates:I have discussed unordered_map in my previous post, but there is a limitation, we can not store duplicates in unordered_map, that is if we have a key-value pair already in our u原创 2021-04-03 00:01:16 · 122 阅读 · 0 评论 -
STL-23 unordered_map in C++ STL (Introduced in C++11)
unordered_map in C++ STL (Introduced in C++11)unordered_map is an associated container that stores elements formed by combination of key value and a mapped value. The key value is used to uniquely identify the element and mapped value is the content assoc原创 2021-04-03 00:01:05 · 149 阅读 · 0 评论 -
STL-22 unordered_multiset and its uses(Introduced in C++11)
unordered_multiset and its uses(Introduced in C++11)I have discussed about unordered_set in my previous post the problem with unordered_set is that, it is not possible to store duplicate entries in that data structure. For example if we have some value v原创 2021-04-03 00:00:54 · 159 阅读 · 0 评论 -
STL-21 Unordered Sets in C++ Standard Template Library(Introduced in C++11)
Unordered Sets in C++ Standard Template Library(Introduced in C++11)An unordered_set is implemented using a hash table where keys are hashed into indices of a hash table so that the insertion is always randomized. All operations on the unordered_set takes原创 2021-04-02 00:02:35 · 174 阅读 · 0 评论 -
STL-20 Multimap in C++ Standard Template Library
Multimap in C++ Standard Template LibraryMultimap is similar to map with an addition that multiple elements can have same keys. Also, it is NOT required that the key value and mapped value pair has to be unique in this case. One important thing to note ab原创 2021-04-03 00:00:42 · 114 阅读 · 0 评论 -
STL-19 Map in C++ Standard Template Library (STL)
Map in C++ Standard Template Library (STL)Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have same key values.Some basic functions associated with Map:原创 2021-04-02 00:06:09 · 120 阅读 · 0 评论 -
STL-18 Multiset in C++ Standard Template Library (STL)
Multiset in C++ Standard Template Library (STL)Multisets are a type of associative containers similar to set, with an exception that multiple elements can have same values.Some Basic Functions associated with multiset:begin() – Returns an iterator to原创 2021-04-02 00:05:58 · 124 阅读 · 0 评论 -
STL-17 Set in C++ Standard Template Library (STL)
Set in C++ Standard Template Library (STL)Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, though it原创 2021-04-02 00:05:46 · 260 阅读 · 0 评论 -
STL-16 Stack in C++ STL
Stack in C++ STLStacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end and (top) an element is removed from that end only. Stack uses an encapsulated object of either vector(by defaul原创 2021-04-02 00:05:33 · 118 阅读 · 0 评论 -
STL-15 Priority Queue in C++ Standard Template Library (STL)
Priority Queue in C++ Standard Template Library (STL)Priority queues are a type of container adapters, specifically designed such that the first element of the queue is the greatest of all elements in the queue and elements are in non increasing order (he原创 2021-04-02 00:05:20 · 112 阅读 · 0 评论 -
STL-14 Queue in Standard Template Library (STL)
Queue in Standard Template Library (STL)Queues are a type of container adaptors which operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back (end) and are deleted from the front. Queues use an encapsulated object of原创 2021-04-02 00:04:55 · 116 阅读 · 0 评论 -
STL-13 Forward List in C++ | Set 2 (Manipulating Functions)
Forward List in C++ | Set 2 (Manipulating Functions)Some of the operations other than insertions and deletions that can be used in forward lists are as follows :merge() :- This function is used to merge one forward list with other. If both the lists ar原创 2021-04-02 00:04:04 · 84 阅读 · 0 评论 -
STL-12 Forward List in C++ | Set 1 (Introduction and Important Functions)
Forward List in C++ | Set 1 (Introduction and Important Functions)Forward list in STL implements singly linked list. Introduced from C++11, forward list are more useful than other containers in insertion, removal and moving operations (like sort) and allo原创 2021-04-02 00:04:36 · 112 阅读 · 0 评论 -
STL-11 Array class in C++
Array class in C++The introduction of array class from C++11 has offered a better alternative for C-style arrays. The advantages of array class over C-style array are :-Array classes knows its own size, whereas C-style arrays lack this property. So when原创 2021-04-02 00:03:46 · 159 阅读 · 0 评论 -
STL-10 Deque in C++ Standard Template Library (STL)
Deque in C++ Standard Template Library (STL)Double ended queues are sequence containers with the feature of expansion and contraction on both the ends.They are similar to vectors, but are more efficient in case of insertion and deletion of elements. Unli原创 2021-04-01 16:44:50 · 184 阅读 · 0 评论 -
STL-09 List in C++ Standard Template Library (STL)
List in C++ Standard Template Library (STL)Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has been found, insertion and deletion are quick. Normally, when we s原创 2021-04-01 16:41:39 · 110 阅读 · 0 评论 -
STL-08 Vector in C++ STL
Vector in C++ STLVectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector elements are placed in contiguous storage s原创 2021-04-01 16:36:38 · 149 阅读 · 0 评论 -
STL-07 Numeric —— std:: valarray class in C++
Numeric —— std:: valarray class in C++C++98 introduced a special container called valarray to hold and provide mathematical operations on arrays efficiently.It supports element-wise mathematical operations and various forms of generalized subscript ope原创 2021-04-01 16:33:57 · 134 阅读 · 0 评论 -
STL-06 std::partition in C++ STL
std::partition in C++ STLC++ has a class in its STL algorithms library which allows us easy partition algorithms using certain inbuilt functions. Partition refers to act of dividing elements of containers depending upon a given condition.Partition operat原创 2021-04-01 16:32:07 · 153 阅读 · 0 评论 -
STL-05 Array algorithms in C++ STL
Array algorithms in C++ STL (all_of, any_of, none_of, copy_n and iota)From C++11 onwards, some new and interesting algorithms are added in STL of C++. These algorithms operate on an array and are useful in saving time during coding and hence useful in com原创 2021-04-01 16:29:44 · 124 阅读 · 0 评论 -
STL-04 Algorithm Library | C++ Magicians STL Algorithm
Algorithm Library | C++ Magicians STL AlgorithmFor all those who aspire to excel in competitive programming, only having a knowledge about containers of STL is of less use till one is not aware what all STL has to offer.Some of the most used algorithms o原创 2021-04-01 16:27:05 · 157 阅读 · 0 评论 -
STL-03 Binary Search in C++ Standard Template Library
Binary Search in C++ Standard Template Library (STL)Binary search is a widely used searching algorithm that requires the array to be sorted before search is applied. The main idea behind this algorithm is to keep dividing the array in half (divide and con原创 2021-04-01 16:23:44 · 134 阅读 · 0 评论 -
STL-02 Sort in C++ Standard Template Library
2 Sort in C++ Standard Template Library (STL)Sorting is one of the most basic functions applied to data. It means arranging the data in a particular fashion, which can be increasing or decreasing. There is a built-in function in C++ STL by the name of sor原创 2021-04-01 16:19:09 · 199 阅读 · 0 评论