OpenMiner  0.0.1a
Voxel game engine
Public Types | Public Member Functions | List of all members
sol::basic_string_view_hash< Ch, Tr > Struct Template Reference

#include <sol.hpp>

Inheritance diagram for sol::basic_string_view_hash< Ch, Tr >:
std::hash< ::sol::basic_string_view< Ch, Tr > >

Public Types

typedef basic_string_view< Ch, Tr > argument_type
 
typedef std::size_t result_type
 

Public Member Functions

template<typename Al >
result_type operator() (const std::basic_string< Ch, Tr, Al > &r) const
 
result_type operator() (const argument_type &r) const
 

Member Typedef Documentation

§ argument_type

template<typename Ch , typename Tr = std::char_traits<Ch>>
typedef basic_string_view<Ch, Tr> sol::basic_string_view_hash< Ch, Tr >::argument_type

§ result_type

template<typename Ch , typename Tr = std::char_traits<Ch>>
typedef std::size_t sol::basic_string_view_hash< Ch, Tr >::result_type

Member Function Documentation

§ operator()() [1/2]

template<typename Ch , typename Tr = std::char_traits<Ch>>
template<typename Al >
result_type sol::basic_string_view_hash< Ch, Tr >::operator() ( const std::basic_string< Ch, Tr, Al > &  r) const
inline
1153  {
1154  return (*this)(argument_type(r.c_str(), r.size()));
1155  }
basic_string_view< Ch, Tr > argument_type
Definition: sol.hpp:1149

§ operator()() [2/2]

template<typename Ch , typename Tr = std::char_traits<Ch>>
result_type sol::basic_string_view_hash< Ch, Tr >::operator() ( const argument_type r) const
inline
1157  {
1158 #if defined(SOL_USE_BOOST) && SOL_USE_BOOST
1159  return boost::hash_range(r.begin(), r.end());
1160 #else
1161  // Modified, from libstdc++
1162  // An implementation attempt at Fowler No Voll, 1a.
1163  // Supposedly, used in MSVC,
1164  // GCC (libstdc++) uses MurmurHash of some sort for 64-bit though...?
1165  // But, well. Can't win them all, right?
1166  // This should normally only apply when NOT using boost,
1167  // so this should almost never be tapped into...
1168  std::size_t hash = 0;
1169  const unsigned char* cptr = reinterpret_cast<const unsigned char*>(r.data());
1170  for (std::size_t sz = r.size(); sz != 0; --sz) {
1171  hash ^= static_cast<size_t>(*cptr++);
1172  hash *= static_cast<size_t>(1099511628211ULL);
1173  }
1174  return hash;
1175 #endif
1176  }

The documentation for this struct was generated from the following file: