feat: enable toml::get with std::string_view

This commit is contained in:
ToruNiina
2019-04-23 23:24:23 +09:00
parent 0c7d2d07d4
commit d061c33a16

View File

@@ -108,6 +108,18 @@ inline std::string get(value&& v)
return std::move(v.cast<value_t::String>().str); return std::move(v.cast<value_t::String>().str);
} }
// ============================================================================
// std::string_view
#if __cplusplus >= 201703L
template<typename T, typename std::enable_if<
std::is_same<T, std::string_view>::value, std::nullptr_t>::type = nullptr>
inline std::string_view get(const value& v)
{
return std::string_view(v.cast<value_t::String>().str);
}
#endif
// ============================================================================ // ============================================================================
// std::chrono::duration from toml::local_time. // std::chrono::duration from toml::local_time.