X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Funordered%2Ftest%2Fhelpers%2Fequivalent.hpp;h=6d05f20434ade761ffb159201041106c02681683;hb=b32b81446b3b05102be0267e79203f59329c1d97;hp=61b915382a436c3556cfb0bf0bdb878732afe9ee;hpb=215dd7151453fae88e6f968c975b6ce309d42dcf;p=ceph.git diff --git a/ceph/src/boost/libs/unordered/test/helpers/equivalent.hpp b/ceph/src/boost/libs/unordered/test/helpers/equivalent.hpp index 61b915382..6d05f2043 100644 --- a/ceph/src/boost/libs/unordered/test/helpers/equivalent.hpp +++ b/ceph/src/boost/libs/unordered/test/helpers/equivalent.hpp @@ -6,88 +6,91 @@ #if !defined(BOOST_UNORDERED_TESTS_EQUIVALENT_HEADER) #define BOOST_UNORDERED_TESTS_EQUIVALENT_HEADER -#include -#include -#include -#include "./metafunctions.hpp" #include "./fwd.hpp" #include "./list.hpp" +#include "./metafunctions.hpp" +#include +#include +#include +#include -namespace test -{ - template - bool equivalent_impl(T1 const& x, T2 const& y, base_type) { - return x == y; - } +namespace test { + template + bool equivalent_impl(T1 const& x, T2 const& y, base_type) + { + return x == y; + } - template - bool equivalent_impl(boost::hash const&, boost::hash const&, - derived_type) - { - return true; - } + template + bool equivalent_impl( + boost::hash const&, boost::hash const&, derived_type) + { + return true; + } + + template + bool equivalent_impl( + std::equal_to const&, std::equal_to const&, derived_type) + { + return true; + } + + template + bool equivalent_impl( + std::pair const& x1, std::pair const& x2, derived_type) + { + return equivalent_impl(x1.first, x2.first, derived) && + equivalent_impl(x1.second, x2.second, derived); + } - template - bool equivalent_impl(std::equal_to const&, std::equal_to const&, - derived_type) + struct equivalent_type + { + equivalent_type() {} + + template + bool operator()(T1 const& x, T2 const& y) const { - return true; + return equivalent_impl(x, y, derived); } + }; - template - bool equivalent_impl(std::pair const& x1, - std::pair const& x2, derived_type) { - return equivalent_impl(x1.first, x2.first, derived) && - equivalent_impl(x1.second, x2.second, derived); - } + const equivalent_type equivalent; - struct equivalent_type { - equivalent_type() {} + template class unordered_equivalence_tester + { + BOOST_DEDUCED_TYPENAME Container::size_type size_; + BOOST_DEDUCED_TYPENAME Container::hasher hasher_; + BOOST_DEDUCED_TYPENAME Container::key_equal key_equal_; + float max_load_factor_; - template - bool operator()(T1 const& x, T2 const& y) const { - return equivalent_impl(x, y, derived); - } - }; + typedef test::list value_list; + value_list values_; - const equivalent_type equivalent; + public: + unordered_equivalence_tester(Container const& x) + : size_(x.size()), hasher_(x.hash_function()), key_equal_(x.key_eq()), + max_load_factor_(x.max_load_factor()), values_(x.begin(), x.end()) + { + values_.sort(); + } - template - class unordered_equivalence_tester + bool operator()(Container const& x) const { - BOOST_DEDUCED_TYPENAME Container::size_type size_; - BOOST_DEDUCED_TYPENAME Container::hasher hasher_; - BOOST_DEDUCED_TYPENAME Container::key_equal key_equal_; - float max_load_factor_; - - typedef test::list - value_list; - value_list values_; - public: - unordered_equivalence_tester(Container const &x) - : size_(x.size()), - hasher_(x.hash_function()), key_equal_(x.key_eq()), - max_load_factor_(x.max_load_factor()), - values_(x.begin(), x.end()) - { - values_.sort(); - } - - bool operator()(Container const& x) const - { - if(!((size_ == x.size()) && - (test::equivalent(hasher_, x.hash_function())) && - (test::equivalent(key_equal_, x.key_eq())) && - (max_load_factor_ == x.max_load_factor()) && - (values_.size() == x.size()))) return false; - - value_list copy(x.begin(), x.end()); - copy.sort(); - return values_ == copy; - } - private: - unordered_equivalence_tester(); - }; + if (!((size_ == x.size()) && + (test::equivalent(hasher_, x.hash_function())) && + (test::equivalent(key_equal_, x.key_eq())) && + (max_load_factor_ == x.max_load_factor()) && + (values_.size() == x.size()))) + return false; + + value_list copy(x.begin(), x.end()); + copy.sort(); + return values_ == copy; + } + + private: + unordered_equivalence_tester(); + }; } #endif