diff --git a/include/builtin/types.h b/include/builtin/types.h new file mode 100644 index 0000000..1bdd649 --- /dev/null +++ b/include/builtin/types.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +namespace jaclks { + +typedef std::size_t Size_t; + +typedef std::uint32_t UInt32_t; + +} // namespace jaclks diff --git a/include/hash/types.h b/include/hash/types.h new file mode 100644 index 0000000..8f03bf6 --- /dev/null +++ b/include/hash/types.h @@ -0,0 +1,9 @@ +#pragma once + +#include "jaclks/builtin/types.h" + +namespace jaclks { + +typedef Size_t Hash_t; + +} // namespace jaclks diff --git a/include/jaclks/hash/hasher.h b/include/jaclks/hash/hasher.h index be5dc8e..26a18d6 100644 --- a/include/jaclks/hash/hasher.h +++ b/include/jaclks/hash/hasher.h @@ -4,19 +4,20 @@ #include #include "jaclks/compile/type_traits.h" +#include "jaclks/hash/types.h" namespace jaclks { template struct Hasher { - std::size_t operator()(const T &x) const noexcept { + Hash_t operator()(const T &x) const noexcept { return std::hash{}(x); } }; template struct Hasher { - std::size_t operator()(const T *x) const noexcept { + Hash_t operator()(const T *x) const noexcept { if (x == nullptr) { return 0; } @@ -28,7 +29,7 @@ template struct Hasher>> { using Type = std::decay_t; - std::size_t operator()(const T &x) const noexcept { + Hash_t operator()(const T &x) const noexcept { if (x == nullptr) { return 0; }