11 std::vector<int> state;
12 std::vector<int>::iterator it;
13 std::vector<bool> isAvailable;
17 this->it = this->state.begin();
20 void called_from_async()
27 std::cout << "called from async" << std::endl;
28 this->state.insert(this->it ,10);
31 std::string returned_from_async() {
37 //std::cout << "Async call" << std::endl;
42 void print_results(ASYNC &f)
44 std::string result = f.get();
45 std::cout << result.c_str() << std::endl;
50 return this->state.at(pos);
55 return this->state.size();
61 std::future<void> result(std::async(&Test::called_from_async, &test));
63 auto f1 = std::async(std::launch::async, &Test::returned_from_async, &test);
65 std::cout << "Message from main." << std::endl;
68 std::cout << test.getStateSize();
69 } while (test.getStateSize()<1);
73 std::cout << "wait for close";