1 ///////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/container for documentation.
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP
12 #define BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP
14 #ifndef BOOST_CONFIG_HPP
15 # include <boost/config.hpp>
18 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 template<class Allocator>
28 typedef typename Allocator::value_type value_type;
32 explicit equal_to_value(const value_type &t)
36 bool operator()(const value_type &t)const
40 template<class Node, class Pred>
41 struct value_to_node_compare
44 typedef Pred predicate_type;
45 typedef Node node_type;
47 value_to_node_compare()
51 explicit value_to_node_compare(Pred pred)
55 bool operator()(const Node &a, const Node &b) const
56 { return static_cast<const Pred&>(*this)(a.get_data(), b.get_data()); }
58 bool operator()(const Node &a) const
59 { return static_cast<const Pred&>(*this)(a.get_data()); }
61 bool operator()(const Node &a, const Node &b)
62 { return static_cast<Pred&>(*this)(a.get_data(), b.get_data()); }
64 bool operator()(const Node &a)
65 { return static_cast<Pred&>(*this)(a.get_data()); }
67 predicate_type & predicate() { return static_cast<predicate_type&>(*this); }
68 const predicate_type & predicate() const { return static_cast<predicate_type&>(*this); }
71 } //namespace container {
74 #endif //BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP