Вот мой код, main.cpp
:
#include <string>
#include <iostream>
#include <future>
int main() {
using namespace std;
auto p = promise<string>();
p.set_value("Hello, world. ");
auto f = p.get_future();
cout << f.get() << endl;
return 0;
}
Вот ошибка:
./a.out
terminate called after throwing an instance of 'std::system_error'
what():
Unknown error -1 [1]
15195 abort (core dumped) ./a.out
Моя версия компилятора:
$ clang++ --version
clang version 7.0.0-3 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix InstalledDir: /usr/bin
Моя компиляциякоманда:
$ clang++ ./main.cpp && ./a.out