]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/intrusive/test/common_functors.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / intrusive / test / common_functors.hpp
CommitLineData
7c673cae
FG
1/////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2006-2013
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// See http://www.boost.org/libs/intrusive for documentation.
10//
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
14#define BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
15
16#include<boost/intrusive/detail/iterator.hpp>
17#include<boost/intrusive/detail/mpl.hpp>
18#include<boost/static_assert.hpp>
b32b8144 19#include<boost/move/detail/to_raw_pointer.hpp>
7c673cae
FG
20
21namespace boost {
22namespace intrusive {
23namespace test {
24
25template<class T>
26class delete_disposer
27{
28 public:
29 template <class Pointer>
30 void operator()(Pointer p)
31 {
32 typedef typename boost::intrusive::iterator_traits<Pointer>::value_type value_type;
33 BOOST_STATIC_ASSERT(( detail::is_same<T, value_type>::value ));
b32b8144 34 delete boost::movelib::to_raw_pointer(p);
7c673cae
FG
35 }
36};
37
38template<class T>
39class new_cloner
40{
41 public:
42 T *operator()(const T &t)
43 { return new T(t); }
44};
45
46template<class T>
47class new_nonconst_cloner
48{
49 public:
50 T *operator()(T &t)
51 { return new T(t); }
52};
53
54template<class T>
55class new_default_factory
56{
57 public:
58 T *operator()()
59 { return new T(); }
60};
61
62class empty_disposer
63{
64 public:
65 template<class T>
66 void operator()(const T &)
67 {}
68};
69
70struct any_less
71{
72 template<class T, class U>
73 bool operator()(const T &t, const U &u) const
74 { return t < u; }
75};
76
77struct any_greater
78{
79 template<class T, class U>
80 bool operator()(const T &t, const U &u) const
81 { return t > u; }
82};
83
84} //namespace test {
85} //namespace intrusive {
86} //namespace boost {
87
88#endif