mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 09:08:08 +08:00
remove is_castable
This commit is contained in:
@@ -216,33 +216,6 @@ struct storage : public storage_base
|
|||||||
};
|
};
|
||||||
} // detail
|
} // detail
|
||||||
|
|
||||||
// `is_castable` is used for explicit cast of values.
|
|
||||||
// implicit conversion is achieved by the same manner as value::ctor.
|
|
||||||
// so it allows integer->bool conversion.
|
|
||||||
template<typename T, value_t vT>
|
|
||||||
struct is_castable : std::false_type{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Boolean> : std::integral_constant<bool,
|
|
||||||
std::is_convertible<T, toml::Boolean>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Integer> : std::integral_constant<bool,
|
|
||||||
std::is_convertible<T, toml::Integer>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Float> : std::integral_constant<bool,
|
|
||||||
std::is_convertible<T, toml::Float>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::String> : std::integral_constant<bool,
|
|
||||||
std::is_convertible<T, toml::String>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Datetime> : std::integral_constant<bool,
|
|
||||||
std::is_convertible<T, toml::Datetime>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Array> : std::integral_constant<bool,
|
|
||||||
std::is_array<T>::value || toml::detail::is_container<T>::value>{};
|
|
||||||
template<typename T>
|
|
||||||
struct is_castable<T, toml::value_t::Table> : std::integral_constant<bool,
|
|
||||||
toml::detail::is_map<T>::value && toml::detail::is_key_convertible<T>::value>{};
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
template<typename T, typename ... Ts>
|
template<typename T, typename ... Ts>
|
||||||
inline std::unique_ptr<T> make_unique(Ts&& ... args)
|
inline std::unique_ptr<T> make_unique(Ts&& ... args)
|
||||||
@@ -751,7 +724,6 @@ value::cast()
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
// template<typename T, toml::value_t vT = toml::detail::check_type<T>()>
|
// template<typename T, toml::value_t vT = toml::detail::check_type<T>()>
|
||||||
// inline toml::value to_toml(T&& x)
|
// inline toml::value to_toml(T&& x)
|
||||||
// {
|
// {
|
||||||
|
Reference in New Issue
Block a user