C + + template learning
1. C + + template
Template definition: template is a tool to realize the code reuse mechanism. It can realize type parameterization, that is, define types as parameters, so as to realize the real code reusability.
Template classification: function template and class template. Function templates are for functions with different parameter t ...
Added by UrbanCondor on Fri, 03 Dec 2021 09:53:02 +0200
cmake is used to teach the construction of multiple files in multiple directories
1. Use out of source to build multiple directories and multiple files
The file storage method here is as follows:
Where build is the build directory, that is, the build results and intermediate products are in this directory
Include is the include directory
src is the directory of sub functions or dep ...
Added by Alphamonkey on Fri, 03 Dec 2021 02:52:16 +0200
4 program flow structure
4 program flow structure
C/C + + supports three basic program running structures: sequential structure, selection structure and loop structure
Sequence structure: the program is executed in sequence without jumpSelect structure: perform corresponding functions selectively according to whether the conditions are metLoop structure: executes a p ...
Added by indian98476 on Thu, 02 Dec 2021 22:20:42 +0200
c++11 Multithreaded Programming (V)--------- unique_lock
Mutex locks ensure synchronization between threads, but they turn parallel operations into serial operations, which have a significant impact on performance, so we want to minimize the area of locks that we lock, that is, use fine-grained locks.
This lock_guard is not good, not flexible enough, lock_guard can only guarantee unlocking at the ti ...
Added by alex_funky_dj on Thu, 02 Dec 2021 03:24:29 +0200
C + + learning notes - smart pointer, type conversion
Note: the coding tool is CLion+Cygwin64
catalogue
Smart pointer
shared_ptr
Reference counter
Circular reference
weak_ptr
unique_ptr
Copywriting smart pointer
Type conversion
const_cast
static_cast
dynamic_cast
reinterpret_cast
Smart pointer
Smart pointers can be used to automatically recycle object ...
Added by jobe1 on Wed, 01 Dec 2021 20:24:48 +0200
NE abnormal problem
brief introduction
NE, the full name of Native Exception, in Android, mainly refers to exceptions in native programs or natvie libraries running in user space.
NE problems usually lead to program collapse, resulting in unstable functional modules.
Common types of NE problems
The following describes several common Native Crash situations:
...
Added by Leveecius on Wed, 01 Dec 2021 14:24:11 +0200
Memory allocation algorithm
Experiment 4 memory allocation algorithm
1, Experimental purpose
Write a program to simulate the allocation of memory;Through experiments, we can understand how to realize the allocation and recovery of main memory space under the dynamic partition management mode;
2, Background knowledge
A good computer system should not only have a suffic ...
Added by grandadevans on Wed, 01 Dec 2021 13:53:42 +0200
c++11 multithreaded programming (II) -- in depth understanding of thread class constructor
Arguments to constructor
The constructor of std::thread class is implemented using a variable parameter template, that is, any parameter can be passed. The first parameter is the entry function of the thread, and the following parameters are the parameters of the function.
The type of the first parameter is not the function pointer in c langu ...
Added by awpti on Wed, 01 Dec 2021 13:26:43 +0200
Database connection pool
Handwritten database connection pool
The returned is a shared with connection_ PTR object
Key technical points
MySQL database programming, singleton mode, queue container, C++11 multithreading programming, thread mutual exclusion, thread synchronous communication (mutex, conditional variables) and unique_lock, CAS based atomic shaping, ...
Added by Tazerenix on Wed, 01 Dec 2021 12:52:29 +0200
Cardinality sort (bucket sort) -- what is the real function of bucket?
1, Foreword
in the past, the sorting methods we studied were based on comparison, and their efficiency was either quadratic or logarithmic. Bucket sorting is based on container sorting, which is mainly divided into count sorting and cardinality sorting. This paper describes the knowledge of cardinality sorting. the idea of ...
Added by PHPoracle on Wed, 01 Dec 2021 03:24:47 +0200