aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:28:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:30:47 +0200
commit6b7075adc71104c5f6ad652b99fb753565eb67d8 (patch)
tree1f4d91b7cd9ee7cca793f0ecc504ccc4d8dde0d2 /build2/variable.txx
parentdd008d6e48b0bb66e1b9fdc489d9d1d9b4cb8d25 (diff)
Add function machinery, implement path.normalize()
Note that multi-argument functions are not yet "callable" since there is no support for value packs.
Diffstat (limited to 'build2/variable.txx')
-rw-r--r--build2/variable.txx29
1 files changed, 29 insertions, 0 deletions
diff --git a/build2/variable.txx b/build2/variable.txx
index 95e4f0a..7bb30e9 100644
--- a/build2/variable.txx
+++ b/build2/variable.txx
@@ -177,6 +177,35 @@ namespace build2
//
template <typename T>
+ vector<T> value_traits<vector<T>>::
+ convert (names&& ns)
+ {
+ vector<T> v;
+
+ // Similar to vector_append() below except we throw instead of issuing
+ // diagnostics.
+ //
+ for (auto i (ns.begin ()); i != ns.end (); ++i)
+ {
+ name& n (*i);
+ name* r (nullptr);
+
+ if (n.pair)
+ {
+ r = &*++i;
+
+ if (n.pair != '@')
+ throw invalid_argument (
+ string ("invalid pair character: '") + n.pair + "'");
+ }
+
+ v.push_back (value_traits<T>::convert (move (n), r));
+ }
+
+ return v;
+ }
+
+ template <typename T>
void
vector_append (value& v, names&& ns, const variable* var)
{