C++ uses jsoncpp to write code optimization to improve human friendliness

1. Background Notes Daily use jsoncpp When creating a Json, it is often necessary to create a child json, assign a value to the child json, and then save it to the parent json. This code structure is inconsistent with human logic, making it difficult to write, read, and understand. 2. Optimized Discovery For the first few days cpp-http ...

Posted on Mon, 06 Dec 2021 16:10:01 -0500 by jeankaleb

C++11 -- multithreaded programming 5

Translation from: https://thispointer.com//c11-multithreading-part-5-using-mutex-to-fix-race-conditions/ In this article, we will discuss how to use mutexes to protect shared data in a multithreaded environment and avoid race conditions. In order to repair the contention condition in a multithreaded environment, we need a mutex, that is, each t ...

Posted on Mon, 08 Nov 2021 06:22:20 -0500 by depraved

Strange keywords encountered in c + + thread pool and some functions of new features of C++11

Recently, I learned thread pool by myself. After reading other people's codes, I found that some functions and some strange keywords in the new features of C++11 are used in many codes. In addition, I don't know what this function is. As a result, I don't know how to understand it. After some reference, I understand something. I hereby record i ...

Posted on Sun, 07 Nov 2021 12:20:09 -0500 by cdpapoulias

[C++ 11] thread namespace for multithreaded programming - this_thread

In C++11, not only the thread class is added, but also a namespace STD:: this about threads is added_ Thread, which provides four common member functions in this namespace. Through these member functions, you can perform relevant operations on the current thread. 1. get_id() Calling namespace STD:: this_ Get in thread_ The ID () method can ge ...

Posted on Mon, 25 Oct 2021 09:13:54 -0400 by b0gner17

[C++ 11] thread class of multithreaded programming

Before C++11, C + + language did not provide language level support for concurrent programming, which makes us have a lot of inconvenience when writing portable concurrent programs. Now C++11 adds threads and thread related classes, which conveniently supports concurrent programming, and greatly improves the portability of multithreaded program ...

Posted on Mon, 25 Oct 2021 08:13:34 -0400 by bhoward3