Output Code
Output Code
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <thread>
#include <future>
#include <mutex>
std::mutex mtx;
int main() {
const int size = 1000000;
std::vector<int> data(size);
std::iota(data.begin(), data.end(), 1);
int total_sum = 0;
for (auto& future : futures) {
total_sum += future.get();
}