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

[18] Linked list of C + + STL container

Linked list of C++STL container The underlying principle of C++STL list In fact, its bottom layer is the two-way linked list of data structure. It can be traversed from the beginning or from the end, but it is not cyclic. In STL, such a two-way linked list is encapsulated into a class, which is convenient for developers to use directly an ...

Posted by cute_girl on Sat, 09 Oct 2021 22:23:16 -0700

Design pattern, detailed explanation of responsibility chain pattern, c + + implementation

Detailed explanation of responsibility chain mode, c + + implementation Responsibility chain model Definition: multiple objects have the opportunity to process the request, avoid the coupling relationship between the sender and receiver of the request, connect the processing objects into a chain, and pass the request along the chain until an o ...

Posted by yorktown on Sat, 09 Oct 2021 21:26:48 -0700

Standard Template Library algorithm (all functions)

Catalog Adjacent_find All_of (returns true if all iterator intervals meet criteria, false otherwise) Any_of (returns true if one of the iterator intervals meets the criteria, false otherwise) Binary_search (binary search, find return true, otherwise return false) Copy (copy an interval to the target iterator location) Copy_backward (copy ...

Posted by cpace1983 on Sat, 09 Oct 2021 09:47:06 -0700

C++ std::condition_variable wait() wait_for() is different from how to use instances

1, std::condition_variable is a conditional variable. 2, wait() When STD:: condition_ When a wait function of the variable object is called, it uses STD:: unique_ Lock (through std::mutex) to lock the current thread. The current thread will be blocked until another thread is in the same STD:: condition_ The variable object calls the notif ...

Posted by Jurge on Sat, 09 Oct 2021 06:01:16 -0700

Linux C/C + + shared memory with message queue and semaphore encapsulation

Encapsulation of Linux 'C/C + + shared memory with message queue + semaphore 1, Train of thought The server demo I do is divided into two servers: the front server and the rear server. The front server is used to receive information, contract and unpack, while the rear server is used to process the package business. The front and rear process ...

Posted by no_one on Fri, 08 Oct 2021 22:28:22 -0700

Algorithm learning notes - merge sort

Merge sort Merging is an algorithm based on divide and conquer, which is to split an array into small arrays in half, sort them in turn, and finally merge these sorted arrays. (divide and Conquer: big problems are divided into small problems and solved one by one) Stepwise analysis Suppose we have an array of {5, 8, 1, 0, 2, 9, 7, 4}. We ne ...

Posted by harinath on Fri, 08 Oct 2021 20:27:38 -0700

gcc generates static library. a and dynamic library. so Xiao Chen can't sleep

One. Generate static library and dynamic library with Gcc. 3. Static library When the program is compiled, it will be connected to the object code. The existence of static library is not required for program operation. 3. Dynamic library It is not connected to the object code when the program is compiled, but loaded when the program is runn ...

Posted by jinky32 on Fri, 08 Oct 2021 11:59:03 -0700

[c++] Encapsulation, Initialization and Cleaning of Objects

Write at the beginning Reference Black Horse Programmer c++ Core Programming 4. Classes and Objects 4.1 Packaging Encapsulation is one of the three object-oriented features of C++. Significance of 4.1.1 Packaging (1). Express the things in life by taking attributes and behaviors as a whole (2) Control of attributes and behaviors with priv ...

Posted by lalabored on Fri, 08 Oct 2021 10:42:15 -0700

STL Standard Template Library Learning Notes 2 (STL sorting container)

Associative containers can quickly find, read or delete stored elements. At the same time, this type of container is more efficient than sequential containers in inserting elements. The elements stored in associative containers are "key value pairs" (< key, value >), which is the biggest difference from sequential containers. I ...

Posted by shmeeg on Thu, 07 Oct 2021 23:48:54 -0700