mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
add from_string to utility
This commit is contained in:
@@ -62,5 +62,16 @@ std::string concat_to_string(Ts&& ... args)
|
||||
return detail::concat_to_string_impl(oss, std::forward<Ts>(args) ...);
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
T from_string(const std::string& str, U&& opt)
|
||||
{
|
||||
T v(std::forward<U>(opt));
|
||||
std::istringstream iss(str);
|
||||
iss >> v;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}// toml
|
||||
#endif // TOML11_UTILITY
|
||||
|
||||
Reference in New Issue
Block a user