Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:a67ba4695c223a905ff108ed8b9a342f
Created July 8, 2017 10:22
Abusing co_await for optionals in C++
// Changed awaiter to not leak memory on suspension thanks to /u/Enemii.
#include <experimental/coroutine>
#include <iostream>
#include <memory>
#include <optional>
#include <utility>
template<typename T>
class shared_optional {