From eaa3604dce24f1e47de2ddb346d0a338279d05c1 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 1 Jun 2019 16:01:48 +0900 Subject: [PATCH] refactor: introduce value_t_constant as an alias for integral_constant --- toml/types.hpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/toml/types.hpp b/toml/types.hpp index f283df8..f15e955 100644 --- a/toml/types.hpp +++ b/toml/types.hpp @@ -81,6 +81,10 @@ inline std::basic_string stringize(value_t t) namespace detail { +// helper to define a type that represents a value_t value. +template +using value_t_constant = std::integral_constant; + // meta-function that convertes from value_t to the exact toml type that corresponds to. // It takes toml::basic_value type because array and table types depend on it. template struct enum_to_type {using type = void ;}; @@ -100,21 +104,21 @@ template struct enum_to_type{us template struct type_to_enum : typename std::conditional< std::is_same::value, // if T == array_type, - std::integral_constant, // then value_t::array + value_t_constant, // then value_t::array typename std::conditional< // else... std::is_same::value, // if T == table_type - std::integral_constant, // then value_t::table - std::integral_constant // else value_t::empty + value_t_constant, // then value_t::table + value_t_constant // else value_t::empty >::type >::type {} -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; -template struct type_to_enum: std::integral_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; +template struct type_to_enum: value_t_constant {}; // meta-function that checks the type T is the same as one of the toml::* types. template