diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj b/src/beast/Builds/VisualStudio2012/beast.vcxproj index 07698e5e09..e9a17f387f 100644 --- a/src/beast/Builds/VisualStudio2012/beast.vcxproj +++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj @@ -202,6 +202,7 @@ + diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters index 723f102f8b..c1717f4456 100644 --- a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters +++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters @@ -1239,6 +1239,9 @@ beast\chrono + + beast\utility + diff --git a/src/beast/beast/Utility.h b/src/beast/beast/Utility.h index b7cd0854ce..6c9685343f 100644 --- a/src/beast/beast/Utility.h +++ b/src/beast/beast/Utility.h @@ -29,5 +29,7 @@ #include "utility/PropertyStream.h" #include "utility/StaticObject.h" +#include "utility/hash_pair.h" + #endif diff --git a/src/beast/beast/chrono/impl/abstract_clock.cpp b/src/beast/beast/chrono/impl/abstract_clock.cpp index af9892b31a..11cc561412 100644 --- a/src/beast/beast/chrono/impl/abstract_clock.cpp +++ b/src/beast/beast/chrono/impl/abstract_clock.cpp @@ -27,14 +27,6 @@ namespace beast { -template -std::basic_ostream & operator<< ( - std::basic_ostream& os, std::chrono::time_point < - abstract_clock , Duration2> const& tp) -{ - return os; -} - class abstract_clock_tests : public UnitTest { public: diff --git a/src/beast/beast/utility/hash_pair.h b/src/beast/beast/utility/hash_pair.h new file mode 100644 index 0000000000..ded3afffc1 --- /dev/null +++ b/src/beast/beast/utility/hash_pair.h @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +/* + This file is part of Beast: https://github.com/vinniefalco/Beast + Copyright 2013, Vinnie Falco + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#ifndef BEAST_UTILITY_HASH_PAIR_H_INCLUDED +#define BEAST_UTILITY_HASH_PAIR_H_INCLUDED + +#include +#include + +#include +#include + +namespace std { + +/** Specialization of std::hash for any std::pair type. */ +template +struct hash > + : private boost::base_from_member , 0> + , private boost::base_from_member , 1> +{ +private: + typedef boost::base_from_member , 0> first_hash; + typedef boost::base_from_member , 1> second_hash; + +public: + hash () + { + } + + hash (std::hash const& first_hash_, + std::hash const& second_hash_) + : first_hash (first_hash_) + , second_hash (second_hash_) + { + } + + std::size_t operator() (std::pair const& value) + { + std::size_t result (first_hash::member (value.first)); + boost::hash_combine (result, second_hash::member (value.second)); + return result; + } + + std::size_t operator() (std::pair const& value) const + { + std::size_t result (first_hash::member (value.first)); + boost::hash_combine (result, second_hash::member (value.second)); + return result; + } +}; + +} + +#endif