diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-06 15:54:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-06 15:54:07 +0200 |
commit | 8e258e150743f9d71a7bbd9f70af78a05d354456 (patch) | |
tree | a7da748a935e965bfe7de93eb2c9fd7192d4878e /build2/variable.txx | |
parent | beffa27ce8038c8e6d30b90f95a9d55ff5068c08 (diff) |
Work around wrong static initialization order in VC
Diffstat (limited to 'build2/variable.txx')
-rw-r--r-- | build2/variable.txx | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/build2/variable.txx b/build2/variable.txx index d566a04..8db2ea9 100644 --- a/build2/variable.txx +++ b/build2/variable.txx @@ -357,13 +357,20 @@ namespace build2 } template <typename T> - const string value_traits<vector<T>>::type_name = string ( - value_traits<T>::type_name) + 's'; + value_traits<vector<T>>::value_type_ex:: + value_type_ex (value_type&& v) + : value_type (move (v)) + { + type_name = value_traits<T>::type_name; + type_name += 's'; + name = type_name.c_str (); + } template <typename T> - const value_type value_traits<vector<T>>::value_type = // VC14 wants =. + const typename value_traits<vector<T>>::value_type_ex + value_traits<vector<T>>::value_type = build2::value_type // VC14 wants =. { - value_traits<vector<T>>::type_name.c_str (), + nullptr, // Patched above. sizeof (vector<T>), nullptr, // No base. &default_dtor<vector<T>>, @@ -516,14 +523,22 @@ namespace build2 } template <typename K, typename V> - const string value_traits<std::map<K, V>>::type_name = string ( - value_traits<K>::type_name) + '_' + - value_traits<V>::type_name + "_map"; + value_traits<std::map<K, V>>::value_type_ex:: + value_type_ex (value_type&& v) + : value_type (move (v)) + { + type_name = value_traits<K>::type_name; + type_name += '_'; + type_name += value_traits<V>::type_name; + type_name += "_map"; + name = type_name.c_str (); + } template <typename K, typename V> - const value_type value_traits<std::map<K, V>>::value_type = // VC14 wants =. + const typename value_traits<std::map<K, V>>::value_type_ex + value_traits<std::map<K, V>>::value_type = build2::value_type // VC14 wants = { - value_traits<map<K, V>>::type_name.c_str (), + nullptr, // Patched above. sizeof (map<K, V>), nullptr, // No base. &default_dtor<map<K, V>>, |