aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-16 10:53:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:30:47 +0200
commitaeeedd32f8717d8c6a1886a5561a879059be87d0 (patch)
treecdd4c893e05a1e950f689443ac63f532df721352 /build2/variable
parenta7efabf301f23364ac2335c80c5e1e712bc43204 (diff)
Make names and vector<name> different types, add typed value constructor
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable13
1 files changed, 11 insertions, 2 deletions
diff --git a/build2/variable b/build2/variable
index 6bdc728..ab5586d 100644
--- a/build2/variable
+++ b/build2/variable
@@ -165,11 +165,18 @@ namespace build2
~value () {*this = nullptr;}
explicit
- value (const value_type* t = nullptr): type (t), null (true), extra (0) {}
+ value (nullptr_t = nullptr): type (nullptr), null (true), extra (0) {}
+
+ explicit
+ value (const value_type* t): type (t), null (true), extra (0) {}
explicit
value (names&&); // Create untyped value.
+ template <typename T>
+ explicit
+ value (T); // Create value of value_traits<T>::value_type type.
+
// Note: preserves type.
//
value&
@@ -257,10 +264,12 @@ namespace build2
// Value cast. The first three expect the value to be not NULL. The cast
// from lookup expects the value to aslo be defined.
//
+ // Note that a cast to names expects the value to be untyped while a cast
+ // to vector<names> -- typed.
+ //
// Why are these non-members? The cast is easier on the eyes and is also
// consistent with the cast operators. The other two are for symmetry.
//
- //
template <typename T> T& cast (value&);
template <typename T> T&& cast (value&&);
template <typename T> const T& cast (const value&);