use constexpr value instead of call constexpr func directory

This commit is contained in:
ToruNiina
2018-05-05 12:06:06 +09:00
parent 433636a06f
commit 170b0d6b3f

View File

@@ -592,21 +592,21 @@ template<typename T, typename std::enable_if<
value_traits<T>::is_toml_type, std::nullptr_t>::type> value_traits<T>::is_toml_type, std::nullptr_t>::type>
value::value(T&& v) : type_(toml::detail::check_type<T>()) value::value(T&& v) : type_(toml::detail::check_type<T>())
{ {
switch_assign<toml::detail::check_type<T>()>::invoke( constexpr value_t kind = toml::detail::check_type<T>();
*this, std::forward<T>(v)); switch_assign<kind>::invoke(*this, std::forward<T>(v));
} }
template<typename T, typename std::enable_if< template<typename T, typename std::enable_if<
value_traits<T>::is_toml_type, std::nullptr_t>::type> value_traits<T>::is_toml_type, std::nullptr_t>::type>
value& value::operator=(T&& v) value& value::operator=(T&& v)
{ {
constexpr value_t kind = toml::detail::check_type<T>();
if(should_be_cleaned(this->type_)) if(should_be_cleaned(this->type_))
{ {
switch_clean(this->type_); switch_clean(this->type_);
} }
this->type_ = toml::detail::check_type<T>(); this->type_ = kind;
switch_assign<toml::detail::check_type<T>()>::invoke( switch_assign<kind>::invoke(*this, std::forward<T>(v));
*this, std::forward<T>(v));
return *this; return *this;
} }