1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

boost::hash_combine removed

This commit is contained in:
mordred 2018-10-26 09:29:57 +02:00
parent e1a0a99579
commit 10741cdbcc
4 changed files with 16 additions and 9 deletions

View file

@ -3,9 +3,9 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include <functional>
namespace Core { namespace Core::Util {
namespace Util {
std::string binaryToHexString( uint8_t* pBinData, uint16_t size ); std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
@ -24,7 +24,14 @@ int64_t getTimeSeconds();
uint64_t getEorzeanTimeStamp(); uint64_t getEorzeanTimeStamp();
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex ); void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
template <class T>
inline void hashCombine( std::size_t& seed, const T& v )
{
std::hash<T> hasher;
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
} }
} }
#endif #endif

View file

@ -6,7 +6,6 @@
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp> #include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <Config/ConfigMgr.h> #include <Config/ConfigMgr.h>

View file

@ -3,8 +3,8 @@
#include <asio.hpp> #include <asio.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
#include <Util/Util.h>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include <thread> #include <thread>
@ -23,10 +23,11 @@ public:
}; };
class case_insensitive_hash { class case_insensitive_hash {
public: public:
size_t operator()(const std::string &key) const { size_t operator()( const std::string &key ) const
{
std::size_t seed=0; std::size_t seed=0;
for(auto &c: key) for( auto &c : key )
boost::hash_combine(seed, std::tolower(c)); Core::Util::hashCombine< char >( seed, std::tolower( c ) );
return seed; return seed;
} }
}; };

View file

@ -2,7 +2,6 @@
#define CLIENT_HTTP_HPP #define CLIENT_HTTP_HPP
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
#include <asio.hpp> #include <asio.hpp>
@ -11,6 +10,7 @@
#include <random> #include <random>
#include <mutex> #include <mutex>
#include <type_traits> #include <type_traits>
#include <hash>
class case_insensitive_equals { class case_insensitive_equals {
public: public:
@ -23,7 +23,7 @@ public:
size_t operator()( const std::string &key ) const { size_t operator()( const std::string &key ) const {
std::size_t seed = 0; std::size_t seed = 0;
for( auto &c : key ) for( auto &c : key )
boost::hash_combine( seed, std::tolower( c ) ); Core::Util::hashCombine< char >( seed, std::tolower( c ) );
return seed; return seed;
} }
}; };