diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-21 12:40:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-21 12:40:51 +0200 |
commit | b5ea2b682f8e0c3b8cd0f6692f4991f15d35ddd7 (patch) | |
tree | c90eae847535ce2279676c6ab1d3c7de11a8f96d /butl/optional | |
parent | 499a78602432c4926004f859d5fe957c313adc09 (diff) |
Make optional ctor's constexpr
Diffstat (limited to 'butl/optional')
-rw-r--r-- | butl/optional | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/butl/optional b/butl/optional index 21d686c..18eb67e 100644 --- a/butl/optional +++ b/butl/optional @@ -20,10 +20,10 @@ namespace butl public: typedef T value_type; - optional (): null_ (true) {} - optional (nullopt_t): null_ (true) {} - optional (const T& v): value_ (v), null_ (false) {} - optional (T&& v): value_ (std::move (v)), null_ (false) {} + constexpr optional (): value_ (), null_ (true) {} // VC14 needs value_(). + constexpr optional (nullopt_t): value_ (), null_ (true) {} + constexpr optional (const T& v): value_ (v), null_ (false) {} + constexpr optional (T&& v): value_ (std::move (v)), null_ (false) {} optional& operator= (nullopt_t) {value_ = T (); null_ = true; return *this;} optional& operator= (const T& v) {value_ = v; null_ = false; return *this;} |