diff options
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r-- | libbuild2/variable.hxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx index 6a2c681..3389a8e 100644 --- a/libbuild2/variable.hxx +++ b/libbuild2/variable.hxx @@ -954,6 +954,33 @@ namespace build2 static const value_type_ex value_type; }; + // vector<pair<K, V>> + // + template <typename K, typename V> + struct value_traits<vector<pair<K, V>>> + { + static_assert (sizeof (vector<pair<K, V>>) <= value::size_, + "insufficient space"); + + static void assign (value&, vector<pair<K, V>>&&); + static void append (value&, vector<pair<K, V>>&&); + static void prepend (value& v, vector<pair<K, V>>&& x) { + return append (v, move (x));} + static bool empty (const vector<pair<K, V>>& x) {return x.empty ();} + + static const vector<pair<K, V>> empty_instance; + + // Make sure these are static-initialized together. Failed that VC will + // make sure it's done in the wrong order. + // + struct value_type_ex: build2::value_type + { + string type_name; + value_type_ex (value_type&&); + }; + static const value_type_ex value_type; + }; + // map<K, V> // template <typename K, typename V> @@ -995,6 +1022,9 @@ namespace build2 extern template struct LIBBUILD2_DECEXPORT value_traits<uint64s>; extern template struct LIBBUILD2_DECEXPORT + value_traits<vector<pair<string, string>>>; + + extern template struct LIBBUILD2_DECEXPORT value_traits<std::map<string, string>>; extern template struct LIBBUILD2_DECEXPORT |