enable to get toml::value as toml::value

This commit is contained in:
ToruNiina
2018-12-16 20:50:40 +09:00
parent 0c08b9e940
commit c2e733a65d
2 changed files with 32 additions and 0 deletions

View File

@@ -33,6 +33,30 @@ inline T&& get(value&& v)
return std::move(v.cast<detail::toml_value_t<T>::value>());
}
// ============================================================================
// T == toml::value; identity transformation.
template<typename T, typename std::enable_if<
std::is_same<T, ::toml::value>::value, std::nullptr_t>::type = nullptr>
inline T& get(value& v)
{
return v;
}
template<typename T, typename std::enable_if<
std::is_same<T, ::toml::value>::value, std::nullptr_t>::type = nullptr>
inline T const& get(const value& v)
{
return v;
}
template<typename T, typename std::enable_if<
std::is_same<T, ::toml::value>::value, std::nullptr_t>::type = nullptr>
inline T&& get(value&& v)
{
return std::move(v);
}
// ============================================================================
// integer convertible from toml::Integer