inline variable in c++17
1, Introduction to inline
It is estimated that anyone who has studied c + + knows the keyword inline. In the application of functions, there is the use of inline functions (for specific usage, please refer to the previous articles, which will not be expanded here). Inline function ensures that the function has the same copy in each compilation ...
Added by pcjackson06 on Sat, 06 Nov 2021 13:29:46 +0200
Common STL algorithm II of C + + improvement Part 9
——Common sorting algorithms
Algorithm Introduction
Sort / / sort the elements in the containerrandom_shuffle / / (shuffle) randomly adjust the order of elements within the specified rangeMerge / / merge container elements and store them in another containerreverse / / reverses the elements in the specified range
sort algorit ...
Added by jen56456 on Sat, 06 Nov 2021 13:05:22 +0200
LeetCode268. Missing numbers
268. Missing numbers
Given an array num containing N numbers in [0, n], find the number that does not appear in the array within the range of [0, n].
Example 1:
Input: nums = [3,0,1]
Output: 2
Explanation: n = 3,Because there are three numbers, all the numbers are in the range [0,3] Inside. 2 is the missing number because it does not appea ...
Added by buildakicker on Sat, 06 Nov 2021 12:01:19 +0200
C++json library nlohmann simple use tutorial
For relevant concepts of Jason, see Simple use of C++ Json Library.
1. Define JSON value type
If you want to create a JSON object in the following form:
{
"pi": 3.141,
"happy": true,
"name": "Niels",
"nothing": null,
"answer": {
"everything": 42
},
"list": [1, 0, 2],
"object": {
"currency": "USD",
"valu ...
Added by jonasr on Sat, 06 Nov 2021 11:26:47 +0200
C + + exercises with answers
Job 1 (Section2 to Section5)
Write a C + + program to convert binary numbers to decimal numbers and convert decimal numbers to binary numbers. The program prompts the user to enter a number. You must read the number as a string. If the number is binary, convert it to decimal. If the number is decimal, convert it to binary. If the number is ...
Added by sspatel82 on Sat, 06 Nov 2021 05:12:45 +0200
Pure C + + realizes the reading and modification of 24 bit bmp format pictures
Problem: there is an existing bmp picture. It is required to read it into the program and perform one of the four effects of graying, horizontal flip, blur and Tan filter, and output a new picture, as shown below:
Command line input:
Of which:
Parameter 1: - b/g/s/r, indicating blur, gray, sepia and row reverse successively
...
Added by PartyMarty on Sat, 06 Nov 2021 03:22:42 +0200
C++ map and unordered_map usage and differences
Go to: Map and unordered_ The difference and use of map_ Chen Yunjia's column - CSDN blog_ unordered_map and map
C++STL: unordered_map - Ling Yao - blog Park
The header files to be imported are different
map: #include < map > unordered_map: #include < unordered_map >
Different internal implementation mechanisms
Map: a red bla ...
Added by gazalec on Sat, 06 Nov 2021 01:16:45 +0200
C++ Classes and Objects
Six default member functions for classes If there is no member in a class, it is simply an empty class. Nothing in the empty class? No, any of the classes will automatically generate the following six default member functions if we don't write them.
Constructor
concept
For the following date classes:
class Date
{
public:
void Init(int ...
Added by cwetherbee on Fri, 05 Nov 2021 18:13:55 +0200
[C + + beginner level] C&C + + memory management
catalogue
1, C/C + + memory distribution
2, Dynamic memory management in C language
3, C + + memory management mode
4, operator new and operator delete functions
5, Common interview questions
The difference between malloc/free and new/delete:
Memory leak:
How to prevent memory leaks:
1, C/C + + memory distribution ...
Added by tidou on Fri, 05 Nov 2021 01:03:02 +0200
OpenCV C + + case practice III "QR code detection"
preface
This article will use OpenCV C + + for QR code detection.
1, QR code detection
Firstly, we must preprocess the image and extract the image contour through gray, filtering, binarization and other operations. Here I also added morphological operations to eliminate noise and effectively connect rectangular areas.
Mat gray;
cvt ...
Added by kylevisionace02 on Thu, 04 Nov 2021 12:18:18 +0200