June 2017
Intermediate to advanced
532 pages
12h 59m
English
In this section, we are going to implement some functions that simulate computation-intensive tasks that depend on each other, and let them run as parallel as possible:
#include <iostream> #include <iomanip> #include <thread> #include <string> #include <sstream> #include <future> using namespace std; using namespace chrono_literals;
struct pcout : public stringstream { static inline mutex cout_mutex; ~pcout() { lock_guard<mutex> l {cout_mutex}; cout << rdbuf(); cout.flush(); } };
Read now
Unlock full access