]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/container/include/boost/container/detail/compare_functors.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / container / include / boost / container / detail / compare_functors.hpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////////////////////
2//
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)
6//
7// See http://www.boost.org/libs/container for documentation.
8//
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP
12#define BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP
13
14#ifndef BOOST_CONFIG_HPP
15# include <boost/config.hpp>
16#endif
17
18#if defined(BOOST_HAS_PRAGMA_ONCE)
19# pragma once
20#endif
21
22namespace boost {
23namespace container {
24
25template<class Allocator>
26class equal_to_value
27{
28 typedef typename Allocator::value_type value_type;
29 const value_type &t_;
30
31 public:
32 explicit equal_to_value(const value_type &t)
33 : t_(t)
34 {}
35
36 bool operator()(const value_type &t)const
37 { return t_ == t; }
38};
39
40template<class Node, class Pred>
41struct value_to_node_compare
42 : Pred
43{
44 typedef Pred predicate_type;
45 typedef Node node_type;
46
47 value_to_node_compare()
48 : Pred()
49 {}
50
51 explicit value_to_node_compare(Pred pred)
52 : Pred(pred)
53 {}
54
55 bool operator()(const Node &a, const Node &b) const
56 { return static_cast<const Pred&>(*this)(a.get_data(), b.get_data()); }
57
58 bool operator()(const Node &a) const
59 { return static_cast<const Pred&>(*this)(a.get_data()); }
60
61 bool operator()(const Node &a, const Node &b)
62 { return static_cast<Pred&>(*this)(a.get_data(), b.get_data()); }
63
64 bool operator()(const Node &a)
65 { return static_cast<Pred&>(*this)(a.get_data()); }
66
67 predicate_type & predicate() { return static_cast<predicate_type&>(*this); }
68 const predicate_type & predicate() const { return static_cast<predicate_type&>(*this); }
69};
70
71} //namespace container {
72} //namespace boost {
73
74#endif //BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP