element to the list header.Rbegin () returns the reverse iterator pointing to the first element.Remove () delete an element from the listRemove_if () deletes an element based on the specified conditions.Rend () points to the reverse iterator at the end of the listResize () changes the list size.Reverse () Reverse the list elementSize () returns the number of elements in the list.Sort () sorts the listSplice (iterator position, list X) // list. splice (Position, list2) // prior to position in l
I. Category:
StandardSTLSequential container: Vector, String, deque, and list.
StandardSTLAssociated container: Set, Multiset, map, and multimap.
Non-standard sequence containerSlist and rope. Slist is a one-way linked list, and rope is essentially a heavy string
Non-standard associated containerHash_set, hash_multiset, hash_map, and hash_multimap.
Several TypesStandard non-STLContainerIncluding array, bitset, valarray, stack, queue, and priority_queue
It is worth noting that arrays can wo
Preface:
Learning C ++ is now the ninth day, so I just have a simple understanding of C ++ theoretically. I have no practical experience in practical application. so next we will analyze the sgi stl source code.Article, More
This is just a direct analysis of the source code, and there is no experience on the actual application scenario. So we only talk about the source code, and nothing else.
For Hou Jie's article
I have referenced some good
Structure and uses a map (not a map in STL) to manage these segments. Map is a continuous space, and each element is a pointer. Point to another larger continuous linear space and become a buffer zone. The buffer zone is the subject of the deque bucket. Buffer expansion is quite complicated !!!
[Note] deque is a better choice when using the insert/delete operation. It is more appropriate to select vector in other cases.
2) Use
Header file to be load
operation is unsuccessful and ineffective, then you should use list or associative container.5. If you often need to search for elements based on a guideline, you should use the set or multiset to sort the elements with that sort criteria. Remember, in theory, the logarithm complexity is 10 times times better than the linear complexity in the order of 1000 elements. In terms of search speed, hash table is usually 5-10 times faster than a binary tree. But the elements of the hash table are not s
See more details: https://zcheng.ren/2016/08/23/STLVector/
In C + + because the array can not dynamically expand, so in the STL set vector to achieve the role of dynamic array, by allocating contiguous memory space to store elements, if the insertion of elements when the memory space is not large enough, you can reassign the memory to implement a dynamic array.The vector's structure consists of 3 parts: The starting iterator that marks the starting p
NLP self-dream's STL algorithm learning in TianyaSTLAlgorithmSummary:
Prerequisites:
Download STL Source: http://www.sgi.com/tech/stl/download.htmlOpen Web: http://www.sgi.com/tech/stl/stl_index.html
One function object: Function objects are used in many algorithms.
Binary Function object. V1 and V2 are input a
I. Overview
Priority_queue is the queue with the concept of ownership. It allows new elements to be added and old elements to be removed. Call make_heap (), pop_heap (), push_heap () in STL ()AlgorithmImplementation is another form of heap. However, it is a queue, so only elements can be added at the bottom and removed from the top.
Sort: sort by weight, rather than by push. The higher the weight, the lower the weight.
It is allowed to be insert
Algorithm: Used to process elements within a cluster. They can search, sort, modify, and use those elements for different purposes. An action or function that is applied to a container to handle its memory in various ways, such as sort (sort), copy (copy) ...
The algorithm is embodied by the template function, which is not a member function of the container class, is a stand-alone function, they can be used in STL container, and can be used in ordina
Original address: http://www.cnblogs.com/duzouzhe/archive/2010/01/12/1645191.htmlThe STL container can be divided into the following major categories:One: Sequence container: Vector, List, deque, String.II: Associative containers: Set, Multiset, map, Mulmap, Hash_set, Hash_map, Hash_multiset, Hash_multimapIII: Miscellaneous: Stack, queue, Valarray, BitsetImplementation of various STL containers:(1) VectorIn
The common search algorithms are as follows:Find ()Find_if ()//Search_n ()Search ()Find_end ()Find_first_of ()Adjacent_find ()//These two methods are common, try out all the containers, but the lookup efficiency is slow, is the linear lookupFind () This complexity is linear complexityFIND_IF () This complexity is linear complexityAttention:1, if it is an ordered interval, you can use the ordered interval lookup algorithm (Binary_search includes () Lower_bound () Upper_bound ()).2, the associativ
Search_n () is used to find contiguous n-matched values or add predicatesSearch_n (b, E, C, v)Search_n (b, E, C, V, p)Note: The second form of the method should be search_n_if (b, E, C, p)#include STL STL Algorithm for C + +-Find algorithm (2)
The implementation principles of stl are simple and easy to understand, and stl principles are explained.
SummaryPlease use vector for frequent Random Access2. listA list is a two-way linked list, where elements are stored in the heap. Each element is stored in a piece of memory. Its memory space can be discontinuous and data access can be performed through pointers, this feature makes random access very in
STL Series 5: Queue container and stl series queue containerQueue Introduction
Queue is a queue container and a "first-in-first-out" container.
Queue is a simple deque container and becomes another container.
# Include
1. Default Construction of the queue object
The queue is implemented using the template class. The default construction form of the queue object is queue 2. The push () and pop () Metho
Summary of the basic usage of STL container vector and stl container vector
According to ACM program design, we use examples to demonstrate vector usage.
Methods: push_back (), insert (), erase (), clear (), size (), empty ();
Algorithm: reverse (), sort (), accumulate ().
1 # include
Scattered records of STL Learning (constantly updating), and stl learning is constantly updatedI write what I use, so I don't pay too much attention to typographical layout. I will sort it out after I write too much:
1: vector
2: The iterator cannot be set for the priority queue because there is no
3:
# Include
String str2 (str,); // truncate the str string Array 0 ~ Element 7, which comes with the
STL _ FUNCTION template, stl function Template
# Include # Include Using namespace std;
# Define MAX (T )\T max _ # T (T x, T y ){\Return x> y? X: y ;\}// Generate the following three types of functions during preprocessingMAX (int) // int max_int (int x, int y) {return x> y? X: y ;}MAX (double)MAX (string)
# Define mymax (T) max _ # T // The function name is replaced by a macro function
Int main (){Cout Co
STL container, stlArticle from http://blog.csdn.net/zhouyunxuanSeven sequence container types1. vector is a type of representation of arrays. It provides an automatic memory management function to dynamically change the length of a vector object and scale down as elements are added or deleted,It provides Random Access to elements. The time for adding and deleting elements at the end is fixed, but the complexity of inserting and deleting elements in th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.