diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-05 15:09:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-05 15:09:04 +0200 |
commit | 54870fb76b5f59cc2e6d69a8c7a8ef17853a0029 (patch) | |
tree | 770b01aa56348ec75f17fb834a2a7123ba9c3f73 /build2/variable.txx | |
parent | ef7cb7ea3e6fcb21a4fcf38602b3f43f03232ace (diff) |
Add comma, ternary, logical operators support in eval context
Diffstat (limited to 'build2/variable.txx')
-rw-r--r-- | build2/variable.txx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/build2/variable.txx b/build2/variable.txx index ab31a45..d566a04 100644 --- a/build2/variable.txx +++ b/build2/variable.txx @@ -35,6 +35,20 @@ namespace build2 } template <typename T> + T + convert (value&& v) + { + if (v.type == nullptr) + return convert<T> (move (v).as<names> ()); + else if (v.type == &value_traits<T>::value_type) + return move (v).as<T> (); + + throw invalid_argument ( + string ("invalid ") + value_traits<T>::type_name + + " value: conversion from " + v.type->name); + } + + template <typename T> void default_dtor (value& v) { |