]> git.stg.codes - stg.git/blobdiff - include/stg/resetable.h
Ticket 37. The ChangePolicy existence checking and assign value to
[stg.git] / include / stg / resetable.h
index c78d02476e5cbea97d9b80acd764a80aad8d1c61..a451b357326cd946c72b77ddf7b4bd57c65b1a36 100644 (file)
@@ -42,6 +42,19 @@ public:
     const T & data() const throw() { return value; }
     bool empty() const throw() { return !is_set; }
     void reset() throw() { is_set = false; }
+    void splice(const RESETABLE<T> & rhs)
+    {
+        if (rhs.is_set)
+        {
+            value = rhs.value;
+            is_set = true;
+        }
+    }
+    void maybeSet(value_type& dest) const
+    {
+        if (is_set)
+            dest = value;
+    }
 
 private:
     value_type value;