1 #ifndef jb_strtonum_hpp 2 #define jb_strtonum_hpp 18 #define STN_TRAITS(T, F) \ 20 struct stn_traits<T> { \ 21 static T stot(std::string const& s, std::size_t& end) { \ 22 return (F)(s, &end); \ 47 if (end != s.length()) {
51 }
catch (std::exception
const&) {
59 #endif // jb_strtonum_hpp STN_TRAITS(int, std::stoi)
bool strtonum(std::string const &s, T &r)
Generic string to number conversion with validation.
Traits to convert strings to numbers (e.g.
The top-level namespace for the JayBeams library.