diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-05-01 18:47:22 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-05-01 18:47:22 +0100 |
| commit | d7159a9af04d88fa2c741557ec436f08d62ef541 (patch) | |
| tree | bc53e8a10ff7c8c724c13b18385ab9f2ed32da33 /src/string.hh | |
| parent | d3607bc77306c32a86d1b981f1022481ee4acd43 (diff) | |
Add str_to_int_ifp that returns an Optional<int> instead of throwing
Diffstat (limited to 'src/string.hh')
| -rw-r--r-- | src/string.hh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/string.hh b/src/string.hh index da235744..b5ad8e5a 100644 --- a/src/string.hh +++ b/src/string.hh @@ -1,11 +1,12 @@ #ifndef string_hh_INCLUDED #define string_hh_INCLUDED +#include "array_view.hh" +#include "hash.hh" +#include "optional.hh" #include "units.hh" #include "utf8.hh" -#include "hash.hh" #include "vector.hh" -#include "array_view.hh" #include <string> #include <climits> @@ -256,7 +257,8 @@ inline String codepoint_to_str(Codepoint cp) return str; } -int str_to_int(StringView str); +int str_to_int(StringView str); // throws on error +Optional<int> str_to_int_ifp(StringView str); template<size_t N> struct InplaceString |
