diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-18 11:41:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-18 11:41:46 +0200 |
commit | 6434d616da5d75577d142e20e0f9fa430bd625df (patch) | |
tree | e9ad77473aa651d44a6fd31a7b7d23eabfac5a0e | |
parent | 89ea9c8401d9e1b79977c6556b81b2eb4159ef59 (diff) |
Use optional from libbutl
-rw-r--r-- | build/cxx/rule.cxx | 1 | ||||
-rw-r--r-- | build/utility | 29 |
2 files changed, 1 insertions, 29 deletions
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index f05370d..095c98a 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -12,6 +12,7 @@ #include <butl/process> #include <butl/fdstream> +#include <butl/optional> #include <build/scope> #include <build/variable> diff --git a/build/utility b/build/utility index db8e94c..87a0e44 100644 --- a/build/utility +++ b/build/utility @@ -38,35 +38,6 @@ namespace build bool operator() (const P& x, const P& y) const {return *x < *y;} }; - // Simple optional class template while waiting for std::optional. - // - template <typename T> - class optional - { - public: - typedef T value_type; - - optional (): null_ (true) {} - optional (const T& v): value_ (v), null_ (false) {} - optional& operator= (const T& v) {value_ = v; null_ = false; return *this;} - - T& value () {return value_;} - const T& value () const {return value_;} - - T* operator-> () {return &value_;} - const T* operator-> () const {return &value_;} - - T& operator* () {return value_;} - const T& operator* () const {return value_;} - - explicit operator bool () const {return !null_;} - - private: - T value_; - bool null_; - }; - - // Support for reverse iteration using range-based for-loop: // // for (... : reverse_iterate (x)) ... |