-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
24 lines (22 loc) · 805 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <cstdlib>
#include <utility>
#include <iostream>
#include <folly/Format.h>
#include <folly/futures/Future.h>
#include <folly/executors/ThreadedExecutor.h>
#include <folly/Uri.h>
#include <folly/FBString.h>
static void print_uri(const folly::fbstring& value) {
const folly::Uri uri(value);
const auto authority = folly::format("The authority from {} is {}", uri.fbstr(), uri.authority());
std::cout << authority << std::endl;
}
int main() {
folly::ThreadedExecutor executor;
folly::Promise<folly::fbstring> promise;
folly::Future<folly::fbstring> future = promise.getSemiFuture().via(&executor);
folly::Future<folly::Unit> unit = std::move(future).thenValue(print_uri);
promise.setValue("https://conan.io/");
std::move(unit).get();
return EXIT_SUCCESS;
}