Implements assignment binding

This commit is contained in:
2019-05-28 17:49:03 +02:00
parent dbd7dfdd73
commit 5d1c3ac9ba
20 changed files with 443 additions and 152 deletions

View File

@@ -0,0 +1,24 @@
#ifndef PORYGONLANG_HASHEDSTRING_HPP
#define PORYGONLANG_HASHEDSTRING_HPP
#include <string>
class HashedString{
int _hash;
static unsigned constexpr const_hash(char const *input) {
return *input ?
static_cast<unsigned int>(*input) + 33 * const_hash(input + 1) :
5381;
}
public:
explicit HashedString(std::string s){
_hash = const_hash(s.c_str());
}
const int GetHash(){
return _hash;
}
};
#endif //PORYGONLANG_HASHEDSTRING_HPP