make build
make push
make sample-run
version: '3.0'
services:
clang-libcpp-boost-env:
image: shri314/clang-libcpp-boost
entrypoint: sleep infinity
container_name: clang-libcpp-boost-env
restart: always
volumes:
- .:/src
DOCKER_ENV_CMD = docker exec -it clang-libcpp-boost-env
all: sample-run
up:
docker-compose up -d
down:
docker-compose down
sample: up sample.o
$(DOCKER_ENV_CMD) clang++ -std=c++2a -fcoroutines-ts -stdlib=libc++ -lc++abi -o sample sample.o
sample.o: up sample.cpp
$(DOCKER_ENV_CMD) clang++ -std=c++2a -fcoroutines-ts -stdlib=libc++ -c sample.cpp
sample-run: sample
$(DOCKER_ENV_CMD) ./sample
clean:
rm -f sample sample.o
#include <iostream>
#include <optional>
#include <string>
#include <experimental/coroutine>
#include <boost/lexical_cast.hpp>
int x = 0;
std::optional<int> foo() {
return []() {
return x++;
}();
}
int main() {
std::cout << "Hello " << *foo() << "\n";
std::cerr << "Hello " << *foo() << "\n";
std::clog << "Hello " << boost::lexical_cast<std::string>(*foo()) << "\n";
}
make