[STL source code analysis] summary notes (9): set/multiset and map/multimap

00 in front [STL source code analysis] summary note (8): Exploration of red black tree The content of this article is much simpler on the basis of red and black trees. set and map need to understand their structures. It's best to use them easily in the actual process of using STL. Because the red black tree is used as the bottom layer, it sho ...

Posted by beboni on Tue, 30 Nov 2021 04:20:47 -0800

Experience in stl application -- ptr_fun,mem_fun,mem_fun_ref

First, let's look at an example. #include <iostream> #include <vector> #include <algorithm> #include <iterator> using namespace std; class Widget{ public: Widget(int a) : m_a(a) { } int value() const { return m_a; } bool test() { return m_a % 3; } private: int m_a; }; bool test(const Widget& ...

Posted by cavendano on Sun, 28 Nov 2021 07:55:59 -0800

3. C++ STL: deque container

3.3 deque container Disclaimer: This article is a note on learning C++ STL - standard template library, which is convenient for later review; Mainly refer to C++ Prime, C + + standard library Dark horse programmer's ingenuity | C + + tutorial: introduction to programming from 0 to 1 Wait. 3.3.1 basic concept of deque container Fun ...

Posted by meritre on Fri, 19 Nov 2021 22:10:43 -0800

STL source code analysis overview

  catalogue Node of list list is more complex than vector's continuous linear space. Its storage space is discontinuous. The advantage is that each time an element is inserted and deleted, only one element's space needs to be configured or releasedIt is very convenient to insert and delete Node of list The list itself and the nodes of ...

Posted by cesar110 on Fri, 19 Nov 2021 03:56:43 -0800

Underlying principle of C++ string

1, Deep and shallow copy Shallow copy: When implementing a string, if you do not copy the string first, a copy constructor will be automatically generated, but it is only a shallow copy. Two string objects point to the same address. When two objects call the destructor, the destructor called by the previous object has released the internal sla ...

Posted by magicmoose on Wed, 17 Nov 2021 08:28:58 -0800

The tragedy of test algorithm training

The tragedy of test algorithm training subject Resource constraints Time limit: 1.0s memory limit: 512.0MB Problem description English preparation gzp is a funny (tu) than (hao). In order not to fail in the upcoming English quiz, gzp forgets to eat and sleep and reviews the English appendix word list, just like a human tragedy. But G ...

Posted by joyser on Thu, 11 Nov 2021 15:17:33 -0800

How to implement the customized iterator

Implement your own iterator IIImplement a tree structure container, and then implement an STL style iterator instance for it.This article is for the last article How to implement user defined iterator Provide supplementary cases.tree_ Implementation of TI intend to implement a simple but not simple tree container and make it a standard contain ...

Posted by crochk on Sun, 31 Oct 2021 05:05:17 -0700

737-C++STL - principle of container space allocator

Implement a simple vector container The implementation of all C++ STL containers needs to rely on a spatial configurator allocator. Although we don't pay attention to it when using containers, we have been using it all the time. The C++ STL library provides a simple implementation of the default spatial configurator allocator. Of course, we ne ...

Posted by robin on Sat, 30 Oct 2021 06:31:20 -0700

Data structure STL -- implementation of comparator by golang

github address: GitHub - hlccd/goSTL  Comparator summary For some data structures with size comparison, it is very cumbersome to implement some size comparison every time. Especially for some officially set types, it will be simple to implement the comparison of their elements when introducing basic types into the data structure. At the s ...

Posted by Richter on Mon, 18 Oct 2021 15:48:26 -0700

STL learning notes - space Configurator

1, Overview Allocator is one of the six components of STL, space configurator. Its function is to manage memory for each container (memory recovery). The allocator configuration object is not only memory, it can also ask for space from the hard disk. Here we mainly consider the memory management. When using STL library, we don't have to consid ...

Posted by niki77 on Sun, 10 Oct 2021 02:54:54 -0700