diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 09:45:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-28 16:03:35 +0200 |
commit | 69801c4e23f877359118e55ed291737f4fbece04 (patch) | |
tree | cd4cb504a5c28aafde601e2d5d4603a44c75b548 /build2/variable | |
parent | 3ce44330cca9dbc4314feebb27403ebc3175b6c2 (diff) |
Add variable cast from lookup
Diffstat (limited to 'build2/variable')
-rw-r--r-- | build2/variable | 8 |
1 files changed, 7 insertions, 1 deletions
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 <typename> 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 <typename T> T& cast (value&); template <typename T> T&& cast (value&&); template <typename T> const T& cast (const value&); + template <typename T> T& cast (const lookup<value>&); + template <typename T> const T& cast (const lookup<const value>&); + // Assign value type to the value. Variable is normally only used for // diagnostics. // |