:#include #include usingnamespace std;...map//Increase ... namemap[" Yeu Bu "]= " Huashan faction head, call the Gentleman Sword ", namemap[" Zhang Sanfeng "]= " Wudang Head, Taijiquan founder "; namemap[" Oriental undefeated "]=" first master, Sunflower Treasure book "; //Find: If(Namemap.find (" Yeu Bu ")! = Namemap.end ()) { ...}Don't you think it's easy to use? And the efficiency is very high, 1 million records, at most also as long as 20 times the String.Compare comparison, can find
After the ANSI/iso c ++ STL standard version is officially passed, each C ++ compiler vendor can implement the C ++ STL generic library according to the prototype described in the standard, as a result, there are a variety of generic Libraries that comply with the standard interface, but the specific implementation code is different, mainly including:
HP
Directory
Problem
SGI Version Space Configurator-std::alloc
First-level Space Configurator
Second-level Space Configurator
Refill, Chunkalloc functions
Finally, the Simple_alloc interface that the Configurator encapsulates
Problem
In our daily writing C + + programs, we often use our STL standard library to help us solve the problem, in which we use the most estimate is its vector, l
C ++ STL study Note 1: General description
This learning note mainly describes the basic knowledge and system framework of C ++ STL. It is mainly suitable for beginners and has some reference value for understanding STL. The notes are illustrated in images and texts, I hope to help you better understand STL.
Main threa
C ++ StandardProgramThe Library provides different containers with their own expertise. Now the question is: how do I select the best container category? The following table provides an overview.
However, some of the descriptions may not be practical. For example, if you need to handle a small number of elements, the complexity can be reduced because of the linearAlgorithmGenerally, the processing of elements is faster. In this case, "Explicit co
This article describes a way to add a dynamic library and a static library to a pro file by using Qtcreator under Windows systems:
1, add dynamic library (directly add dynamic library file. dll, non-subproject)
The method of creating a dynamic library through Qtcreator is
. the Traits programming techniques are described in the previous article!
2. a good use is in the iterator;
3. Why? The premise is that not all template types are class type, some are native pointers, but some point to const T *
However, typedef T value_type cannot be used to extract the correct element type;
4. whether it is a native pointer int * or const int *, you can use traits to retrieve the correct value_type;
5. it is the indirect layer of traits that separates algorithms from data str
Simplified STL Chinese Version"Translation
Just like the first two sister books in this book (semantic C ++, more than tivec ++), the focus of this book is to improve the reader's experience, this time, I only focused on the C ++ standard library, and it is one of the most interesting parts-STL.
C ++ is a programming language that is easy to learn and difficult
Hou Jie said: Tracking first-class programs, absorbing nutrients from them, and imitating the programs he wrote are much more valuable than the third-stream programs that he thinks he is trying to write, at least I think so-99.999% of the world's programs are at the bottom of the three streams in front of STL!
Mr Hou Jie's comment on STL is too high. He used to be familiar with
1. Purpose of writing this articleThis article aims to help some people understand some basic concepts about Windows API, C Runtime Library (CRT), and standard C ++ Library (STL. Many people, even experienced programmers, are vague or even have incorrect ideas about these concepts. If you want to know what they are based on and have no time to understand these co
Allocator and stlallocator for stl Analysis
Allocator encapsulates the memory management system of the stl standard library. The string, container, algorithm, and some iostreams of the standard library are allocated and released through allocator. The component of the standard libr
moving the pointer (because the function is manipulating an iterator and the C + + iterator does not have a delete operation defined), which brings up the problem: we use list because it's very efficient to modify, so change the pointer. And here we copy the elements, if in the vector, it might be efficient, because vectors are copied anyway, and for list is not so, it will greatly reduce our efficiency.
So what do we do?
The answer is to use list's own remove function
Numbers.remove (1);
We
(V.begin (), V.end (), greaterwhile (Prev_permutation (V.begin (), V.end ())){Print_elements (V, "");}}If we encounter a similar problem in the future, we will do so, no more brains, people have ready-made functions, directly to use it.Outside the popular:This paragraph is the real algorithm, STL inside the source codeTemplate inlineBOOL Next_permutation (_bidit _first, _bidit _last){//Permute and test for pure ascending, using operator_bidit _next =
STL (Standard Template Library) Standard Template Library
I. STL has two features:
1. It separates algorithms from data structures.
2. It uses the template in C ++.
Both features aim to make it more universal. For example, the sort function in STL can be used to operate data
Re-review the STLWhat is STL?STL (template and Standard Template Library), which implements type-independent algorithms and data types, requires that the type in the implementation be parameterized, allowing the user to make different types according to its needs.one or one-like introductionSTL, the standard Template Library
// ================================================ ====================================// Title:// MDK streaking STL// Author:// Norains// Date:// Wednesday 16-December-2009// Environment:// MDK 4.0.2// ================================================ ====================================Both MDK and STL are well-known. The former full name is realview microcontroller Development Kit, which is a tool for so
Analysis of map usage in STL [full version]
1 Map OverviewSTL (Standard Template Library) is the core of the C ++ standard library, which profoundly affects the overall structure of the standard library. STL is a general library
multi- ing. Compared with map, duplicate keys are allowed.
Set is regarded as a map, and its values are irrelevant.
Mulitiset allows duplicate keys compared to set.
Bitset bit set
Hash_map hash ing: implements a hash function to implement containers as a hash list to reduce the time required for searching elements.
Standard container specific usage can refer to the C ++ online manual STL container: http://www.cplusplus.com/reference/
iterator as an output or input iterator. Similarly, if an algorithm requires a bidirectional iterator, then only that type and random access iterator can be used.Pointer iteratorAs shown in the following applet, a pointer is also an iterator. The program also shows a major feature of the STL-it is not only available for its own class type, but also for any C or C + + type. Listing 1, Iterdemo.cpp, shows how to use pointers as iterators for the STL's
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service