diff --git a/wxdata/include/scwx/util/hash.hpp b/wxdata/include/scwx/util/hash.hpp new file mode 100644 index 00000000..6559b6a4 --- /dev/null +++ b/wxdata/include/scwx/util/hash.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace scwx +{ +namespace util +{ + +template +struct hash; + +template<> +struct hash> +{ + size_t operator()(const std::pair& x) const; +}; + +} // namespace util +} // namespace scwx diff --git a/wxdata/source/scwx/util/hash.cpp b/wxdata/source/scwx/util/hash.cpp new file mode 100644 index 00000000..31d928a4 --- /dev/null +++ b/wxdata/source/scwx/util/hash.cpp @@ -0,0 +1,20 @@ +#include + +#include + +namespace scwx +{ +namespace util +{ + +size_t hash>::operator()( + const std::pair& x) const +{ + size_t seed = 0; + boost::hash_combine(seed, x.first); + boost::hash_combine(seed, x.second); + return seed; +} + +} // namespace util +} // namespace scwx diff --git a/wxdata/wxdata.cmake b/wxdata/wxdata.cmake index 4adbc60d..de57a39b 100644 --- a/wxdata/wxdata.cmake +++ b/wxdata/wxdata.cmake @@ -46,6 +46,7 @@ set(SRC_PROVIDER source/scwx/provider/aws_level2_data_provider.cpp source/scwx/provider/nexrad_data_provider_factory.cpp) set(HDR_UTIL include/scwx/util/environment.hpp include/scwx/util/float.hpp + include/scwx/util/hash.hpp include/scwx/util/iterator.hpp include/scwx/util/logger.hpp include/scwx/util/map.hpp @@ -56,6 +57,7 @@ set(HDR_UTIL include/scwx/util/environment.hpp include/scwx/util/vectorbuf.hpp) set(SRC_UTIL source/scwx/util/environment.cpp source/scwx/util/float.cpp + source/scwx/util/hash.cpp source/scwx/util/logger.cpp source/scwx/util/rangebuf.cpp source/scwx/util/streams.cpp