From a975e8e96dd0c39e576b9e44a4c35eeef47ebe76 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Sep 2015 16:17:11 +0200 Subject: Fix static initialization order issue --- build/variable | 4 +++- build/variable.txx | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'build') 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 static void assign (value&, V); template 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 static void assign (value&, M); template 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 + const std::string value_traits>::type_name = std::string ( + value_traits::value_type.name) + 's'; + + template const value_type value_traits>::value_type { - value_traits::value_type.name + 's', + value_traits>::type_name.c_str (), &vector_assign, &vector_append }; @@ -150,10 +154,14 @@ namespace build } template + const std::string value_traits>::type_name = std::string ( + value_traits::value_type.name) + '_' + + value_traits::value_type.name + "_map"; + + template const value_type value_traits>::value_type { - value_traits::value_type.name + '_' + - value_traits::value_type.name + "_map", + value_traits>::type_name.c_str (), &map_assign, &map_append }; -- cgit v1.1