aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-04 16:17:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-04 16:17:11 +0200
commita975e8e96dd0c39e576b9e44a4c35eeef47ebe76 (patch)
treee143838c46118a71a34e94de9664d6c718be9709 /build
parent9c4ce4464b2a0dae55b7cfb2ec5fc4bd7ffc40ae (diff)
Fix static initialization order issue
Diffstat (limited to 'build')
-rw-r--r--build/variable4
-rw-r--r--build/variable.txx14
2 files changed, 14 insertions, 4 deletions
diff --git a/build/variable b/build/variable
index 3bd8922..2aec39d 100644
--- a/build/variable
+++ b/build/variable
@@ -32,7 +32,7 @@ namespace build
//
struct value_type
{
- const std::string name;
+ const char* name;
bool (*const assign) (names&, const variable&);
bool (*const append) (names&, names, const variable&);
};
@@ -437,6 +437,7 @@ namespace build
template <typename V> static void assign (value&, V);
template <typename V> static void append (value&, V);
+ static const std::string type_name;
static const build::value_type value_type;
};
@@ -566,6 +567,7 @@ namespace build
template <typename M> static void assign (value&, M);
template <typename M> static void append (value&, M);
+ static const std::string type_name;
static const build::value_type value_type;
};
diff --git a/build/variable.txx b/build/variable.txx
index 1b32584..e661879 100644
--- a/build/variable.txx
+++ b/build/variable.txx
@@ -45,9 +45,13 @@ namespace build
}
template <typename T>
+ const std::string value_traits<std::vector<T>>::type_name = std::string (
+ value_traits<T>::value_type.name) + 's';
+
+ template <typename T>
const value_type value_traits<std::vector<T>>::value_type
{
- value_traits<T>::value_type.name + 's',
+ value_traits<std::vector<T>>::type_name.c_str (),
&vector_assign<T>,
&vector_append<T>
};
@@ -150,10 +154,14 @@ namespace build
}
template <typename K, typename V>
+ const std::string value_traits<std::map<K, V>>::type_name = std::string (
+ value_traits<K>::value_type.name) + '_' +
+ value_traits<V>::value_type.name + "_map";
+
+ template <typename K, typename V>
const value_type value_traits<std::map<K, V>>::value_type
{
- value_traits<K>::value_type.name + '_' +
- value_traits<V>::value_type.name + "_map",
+ value_traits<std::map<K, V>>::type_name.c_str (),
&map_assign<K, V>,
&map_append<K, V>
};