diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-08-24 10:51:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-08-24 10:51:26 +0200 |
commit | b86c1d8d2e0be140f6854d869e07139ff3c4221c (patch) | |
tree | 02b38914484afb6c2a69d041cf026f1d377220bf /libbuild2/variable.cxx | |
parent | b2df0b0663d0537dd3b4f2d28d145ccd90417cab (diff) |
Add copying version of convert<T>(value)
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r-- | libbuild2/variable.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index a4c3ef3..91b25bd 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -410,6 +410,24 @@ namespace build2 v.assign (move (ns), nullptr); // Assign new data. } + [[noreturn]] void + convert_throw (const value_type* from, const value_type& to) + { + string m ("invalid "); + m += to.name; + m += " value: "; + + if (from != nullptr) + { + m += "conversion from "; + m += from->name; + } + else + m += "null"; + + throw invalid_argument (move (m)); + } + // Throw invalid_argument for an invalid simple value. // [[noreturn]] static void |