I would like to ask you, when I seal the timer and use the alarm function to send the signal at a fixed time, how can I correctly use the signal function to set the signal handling function? then the signal handling function is an in-class function ...
An odbc connection mysql program. Use the unicode character set in the project property, return IM002, and connect successfully without using it . related environment W1064Magi VS2015Mysql8.0 related codes the connection code using the unicode char...
projects all use modern CPP,. In principle, they don t have bare pointers. They all use STL smart pointers . but in the library used, there is a function that asks for a T * *, and unique_ptr itself does not provide a reference to return the encapsula...
I tried to use CPP s built-in array as the container at the bottom of the loop queue there is a piece of code to reallocate memory I simplified the code, one of which is as follows template <typename T, typename Allocator> inline void Queue<...
well, I wrote a timer with a callback function func struct Timer { std::function<void(int)> func; ---- sockfd ... Timer(int fd) : clientFd(fd) { ... } }; has a time wheel class TimeWheel { private: st...
this is true. I would like to add a function: the server creates a timer thread to regularly poll to detect sockfd activity, shutting down sockfd that has not been active for a long time but I don t know how to judge whether a sockfd is active or not...
class t { public: vector<shared_ptr<thread> > t1; public: t() { for (int i = 0; i < 3; iPP) { t1.push_back(make_shared<thread>(&t::Func, this)); (1) } } void Func() ...
there is a User class whose method calculate () needs to use a member value in an instance of the external data class as the input source. In the User constructor, you need to pass in different data instances as parameters, and create different User cla...
ref: StackOverflow s question address The answer explained that weak reference counters have an impact on the life cycle of control block. I understand that new is different from make_shared, but I don t understand why control block needs to maint...
Why not provide semaphores directly in RT,CPP11? Instead, it can be implemented jointly with mutexes and conditional variables, for what consideration? ...
when learning < random > library, only seed_seq does not quite understand although I went to MSDN, and cppreference, it is not very clear that there is too little information about seed_seq on Google. my understanding is: when a given seed is not ve...
the standard library container before CPP11 overloaded constant and non-constant object versions for begin and end, and defined cbegin and cend for constant version lines in 11. 11 what is the point of doing this, that is, what is the advantage of suc...
when I see the conditional variables section of CPP11, I find that all conditional variables are used in conjunction with locks, but at this time they all use unique_lock instead of lock_guard,. Can you explain that? ...
CPP11 allows list initialization for all objects, and because the constructor body is assigned, references and const variables must be initialized first, so you must use list initialization, so how is it initialized before CPP11? ...
recently, I am withholding some CPP11 features and projects. When I see the following code, I feel that the whole person is not good. You know what I feel like when I say "the whole person is bad ". Personally, I think learning new knowledge is a habit...
I did a question on leetcode, but for the string type, the push_back concatenation character failed the test, but changed to the plus sign to concatenate the character and passed it. topic link my two codes: class Solution { public: vector<...
unique_ptr < int > test () { unique_ptr<int> ppp(new int(10)); return ppp; } As shown in the code above, ppp can successfully return no error. Ppp is a left value, so it must not be moved, so you have to execute the copy construct...
void exec_produce(int duration) { duration this_thread::sleep_for(chrono::seconds(duration)); this_thread::get_id()id cout << "exec_produce thread " << this_thread::get_id() << " has sleeped &q...
A json string variable is { "a": 1, "b": 2 } wants to escape as the json string { "a ": 1, "b ", 2}. is a variable, so there is no way to use R "() ". The json library uses jsoncpp is there any good way? ...