Extract Optional to own header.

This commit is contained in:
Jared Boone 2016-01-23 21:26:06 -08:00
parent cca8c6dc06
commit 45ae222ab5
2 changed files with 43 additions and 14 deletions

View file

@ -29,20 +29,7 @@
#include "recent_entries.hpp"
template<typename T>
class Optional {
public:
constexpr Optional() : value_ { }, valid_ { false } { };
constexpr Optional(const T& value) : value_ { value }, valid_ { true } { };
constexpr Optional(T&& value) : value_ { std::move(value) }, valid_ { true } { };
bool is_valid() const { return valid_; };
T value() const { return value_; };
private:
T value_;
bool valid_;
};
#include "optional.hpp"
namespace tpms {