aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable10
1 files changed, 8 insertions, 2 deletions
diff --git a/build2/variable b/build2/variable
index 48acfea..10a0f59 100644
--- a/build2/variable
+++ b/build2/variable
@@ -120,14 +120,16 @@ namespace build2
//
//
public:
- ~value () {if (!null ()) *this = nullptr;}
+ ~value () {*this = nullptr;}
explicit
value (const value_type* t = nullptr)
: type (t), state (value_state::null) {}
+ // Note: preserves type.
+ //
value&
- operator= (nullptr_t);
+ operator= (nullptr_t) {if (!null ()) reset (); return *this;}
value (value&&);
explicit value (const value&);
@@ -185,6 +187,10 @@ namespace build2
// Make sure we have sufficient storage for untyped values.
//
static_assert (sizeof (names) <= size_, "insufficient space");
+
+ private:
+ void
+ reset ();
};
// The values should be of the same type (or both be untyped). NULL values