X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f7795445d9e0dd2282b336c89ebe117a2b71a88e..bec5d17c77e9cfc8482ffca062b8f500859bfe34:/include/stg/resetable.h diff --git a/include/stg/resetable.h b/include/stg/resetable.h index 8a6ad27c..e7914efd 100644 --- a/include/stg/resetable.h +++ b/include/stg/resetable.h @@ -16,19 +16,7 @@ public: typedef T value_type; RESETABLE() : value(), is_set(false) {} - RESETABLE(const T & v) : value(v), is_set(true) {} - - RESETABLE(const RESETABLE & rvalue) - : value(rvalue.value), - is_set(rvalue.is_set) - {} - - RESETABLE & operator=(const RESETABLE & rhs) - { - value = rhs.value; - is_set = rhs.is_set; - return *this; - } + explicit RESETABLE(const T & v) : value(v), is_set(true) {} RESETABLE & operator=(const T & rhs) { @@ -50,6 +38,11 @@ public: is_set = true; } } + void maybeSet(value_type& dest) const + { + if (is_set) + dest = value; + } private: value_type value;