Skip to content

Instantly share code, notes, and snippets.

@stryku
Last active April 9, 2017 22:44
Show Gist options
  • Save stryku/c11bb4fc73c7ca1eb5e60dc578d8f6ed to your computer and use it in GitHub Desktop.
Save stryku/c11bb4fc73c7ca1eb5e60dc578d8f6ed to your computer and use it in GitHub Desktop.
template <int sign, int current_val, char current_char, char ...chars>
struct string_to_int_impl<string<'-', current_char, chars...>, sign, current_val>
{
static constexpr auto nex_val = current_val * 10 + (current_char - '0');
static constexpr auto value = string_to_int_impl<string<chars...>, -1, nex_val>::value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment