SOLIDstate
A C++ library for solid state physics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
StrToInt.hpp
Go to the documentation of this file.
1 #ifndef MISC_STRTOINT_HPP
2 #define MISC_STRTOINT_HPP
3 
4 namespace solid
5 {
6 
14 constexpr unsigned int StrToInt(const char *str, int h = 0)
15 {
16  return !str[h] ? 5381 : (StrToInt(str, h + 1) * 33) ^ str[h];
17 }
18 } // namespace solid
19 
20 #endif
constexpr unsigned int StrToInt(const char *str, int h=0)
Covertr string to intiger copied from StackOverflow
Definition: StrToInt.hpp:14