aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-11-12 12:20:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-11-12 12:20:34 +0200
commitc0743592bfae808b61a8146fd97af94b50156f0e (patch)
treea1d0b98f24391ec1350be23eefe5ef492fa3c387 /libbuild2/variable.ixx
parent87d871e77649d439b4d62208576239d1341eedef (diff)
Add support for vector<pair<K, V>> variable values
Diffstat (limited to 'libbuild2/variable.ixx')
-rw-r--r--libbuild2/variable.ixx31
1 files changed, 31 insertions, 0 deletions
diff --git a/libbuild2/variable.ixx b/libbuild2/variable.ixx
index d341c26..d6bf119 100644
--- a/libbuild2/variable.ixx
+++ b/libbuild2/variable.ixx
@@ -707,6 +707,37 @@ namespace build2
new (&v.data_) vector<T> (move (x));
}
+ // vector<pair<K, V>> value
+ //
+ template <typename K, typename V>
+ inline void value_traits<vector<pair<K, V>>>::
+ assign (value& v, vector<pair<K, V>>&& x)
+ {
+ if (v)
+ v.as<vector<pair<K, V>>> () = move (x);
+ else
+ new (&v.data_) vector<pair<K, V>> (move (x));
+ }
+
+ template <typename K, typename V>
+ inline void value_traits<vector<pair<K, V>>>::
+ append (value& v, vector<pair<K, V>>&& x)
+ {
+ if (v)
+ {
+ vector<pair<K, V>>& y (v.as<vector<pair<K, V>>> ());
+
+ if (y.empty ())
+ y.swap (x);
+ else
+ y.insert (y.end (),
+ make_move_iterator (x.begin ()),
+ make_move_iterator (x.end ()));
+ }
+ else
+ new (&v.data_) vector<pair<K, V>> (move (x));
+ }
+
// map<K, V> value
//
template <typename K, typename V>