From aeeedd32f8717d8c6a1886a5561a879059be87d0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 16 Nov 2016 10:53:39 +0200 Subject: Make names and vector different types, add typed value constructor --- build2/variable | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'build2/variable') 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 + explicit + value (T); // Create value of value_traits::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 -- 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 T& cast (value&); template T&& cast (value&&); template const T& cast (const value&); -- cgit v1.1