bool operator()(Heap1 const & lhs, Heap2 const & rhs) { BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap1>)); BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap2>)); // if this assertion is triggered, the value_compare types are incompatible BOOST_STATIC_ASSERT((boost::is_same<typename Heap1::value_compare, typename Heap2::value_compare>::value)); if (Heap1::constant_time_size && Heap2::constant_time_size) if (lhs.size() != rhs.size()) return false; if (lhs.empty() && rhs.empty()) return true; typename Heap1::ordered_iterator it1 = lhs.ordered_begin(); typename Heap1::ordered_iterator it1_end = lhs.ordered_end(); typename Heap1::ordered_iterator it2 = rhs.ordered_begin(); typename Heap1::ordered_iterator it2_end = rhs.ordered_end(); while (true) { if (!value_equality(lhs, rhs, *it1, *it2)) return false; ++it1; ++it2; if (it1 == it1_end && it2 == it2_end) return true; if (it1 == it1_end || it2 == it2_end) return false; } }
bool operator()(Heap1 const & lhs, Heap2 const & rhs) { BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap1>)); BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap2>)); // if this assertion is triggered, the value_compare types are incompatible BOOST_STATIC_ASSERT((boost::is_same<typename Heap1::value_compare, typename Heap2::value_compare>::value)); if (Heap1::constant_time_size && Heap2::constant_time_size) if (lhs.size() != rhs.size()) return false; if (lhs.empty() && rhs.empty()) return true; Heap1 lhs_copy(lhs); Heap2 rhs_copy(rhs); while (true) { if (!value_equality(lhs_copy, rhs_copy, lhs_copy.top(), rhs_copy.top())) return false; lhs_copy.pop(); rhs_copy.pop(); if (lhs_copy.empty() && rhs_copy.empty()) return true; if (lhs_copy.empty()) return false; if (rhs_copy.empty()) return false; } }