From 69801c4e23f877359118e55ed291737f4fbece04 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 28 Mar 2016 09:45:20 +0200 Subject: Add variable cast from lookup --- build2/variable | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'build2/variable') diff --git a/build2/variable b/build2/variable index b5a32d8..57debfa 100644 --- a/build2/variable +++ b/build2/variable @@ -21,6 +21,7 @@ namespace build2 { class value; struct variable; + template struct lookup; struct value_type { @@ -185,15 +186,20 @@ namespace build2 bool operator== (const value&, const value&); bool operator!= (const value&, const value&); - // Value cast. + // Value cast. The first three expect the value to be not NULL. The cast + // from lookup expects the value to aslo be defined. // // 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&); + template T& cast (const lookup&); + template const T& cast (const lookup&); + // Assign value type to the value. Variable is normally only used for // diagnostics. // -- cgit v1.1