Skip to content

Instantly share code, notes, and snippets.

@stryku
Created February 26, 2017 15:09
Show Gist options
  • Save stryku/01d324295727a2e96a713f2762ed890f to your computer and use it in GitHub Desktop.
Save stryku/01d324295727a2e96a713f2762ed890f 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...>, sign, nex_val>::value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment