aboutsummaryrefslogtreecommitdiff
path: root/build/variable
diff options
context:
space:
mode:
Diffstat (limited to 'build/variable')
-rw-r--r--build/variable10
1 files changed, 9 insertions, 1 deletions
diff --git a/build/variable b/build/variable
index fc0ba2b..67ec33c 100644
--- a/build/variable
+++ b/build/variable
@@ -90,11 +90,19 @@ namespace build
// value_proxy
//
+ // A variable can be undefined, null, or contain some actual value.
+ //
struct value_proxy
{
typedef build::scope scope_type;
- explicit operator bool () const {return p != nullptr && *p != nullptr;}
+ bool
+ defined () const {return p != nullptr;}
+
+ bool
+ null () const {return *p == nullptr;}
+
+ explicit operator bool () const {return defined () && !null ();}
explicit operator value_ptr& () const {return *p;}
scope_type* scope;