STL roaming vector

std::vector source code analysis Observe the STL design from the perspective of source code, and the code is implemented as libstdc++(GCC 4.8.5) Because we only focus on the implementation of vector, and the implementation of vector is almost all in the header file, we can use such a method to obtain relatively fresh source code // main.cpp #in ...

Posted by Davo on Sat, 05 Mar 2022 11:14:05 +0100

log4cpp source code reading: Category component learning

The category component is a real Logging object in the Log4Cpp library. We can use the category object to perform various levels of log operations, such as debug, warn, info... And this object can also add various Appenders to distribute log instructions to various appender objects to output to the final destination Relationship between Catego ...

Posted by MasterACE14 on Wed, 02 Mar 2022 04:23:52 +0100

C + + learning notes: template parameters

This chapter mainly studies the basic knowledge of template formal parameters. There are three types of template parameters: type template parameters, template parameters of templates (taking templates as template parameters), and non type template parameters. Type template parameters Type template parameters are the main purpose of using te ...

Posted by llandudno on Fri, 11 Feb 2022 21:20:18 +0100

C + + learning notes: class template

In the previous chapter, we introduced function templates. In today's chapter, we will learn class templates. Class template declaration Template is the keyword to declare a class template. It means to declare a template. The template parameters can be one or multiple. They can be * * type parameters * * or * * non type parameters** A type pa ...

Posted by dmcentire on Fri, 11 Feb 2022 13:53:38 +0100

State pressure dp (state compression, a number represents a group of States, and the reduced state represents the required dimension)

The problem of light out (state pressure + enumeration) enumerates the state of a row of switches with the size of binary numbers #include <iostream> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; char orilights[5] ; char lights[5] ; ...

Posted by pdn on Fri, 28 Jan 2022 14:45:14 +0100

Seastar source code reading - event loop

Seastar event loop reactor::do_run Each thread in the Seastar application calls reactor::do_run() function, enter the event loop, do_ The run() function mainly does the following work: Register various poller s, which are saved in_ pollers data structure (STD:: vector < pollfn * > type).Asynchronous future waits for the network stack t ...

Posted by smoothrider on Tue, 25 Jan 2022 09:14:12 +0100

C + + Learning Notes 2

C + + Learning Notes 2 object-oriented Class string with pointer How to save data? It's good to use pointers. You can't save them one by one Copy construction, copy replication The parameters accepted by the constructor are the object (Reference) of its own class, which is constructed for copy. =Overloaded, the parameter is the object of its ow ...

Posted by mona02 on Wed, 12 Jan 2022 06:13:26 +0100

Summary of common C++STL

Summary of common C++STL 1, vector, variable length array, multiplication idea size() returns the number of elements empty() returns whether it is empty front()/back() returns the head or tail of the array push_back() insert element at tail pop_ Delete element at the end of back() Iterator: begin()/end() Support random addressing: [] Support ...

Posted by MrAdam on Thu, 07 Oct 2021 20:56:45 +0200