]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/icl/include/boost/icl/type_traits/predicate.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / icl / include / boost / icl / type_traits / predicate.hpp
1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2010-2010: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENCE.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef BOOST_ICL_TYPE_TRAITS_PREDICATE_HPP_JOFA_101102
9 #define BOOST_ICL_TYPE_TRAITS_PREDICATE_HPP_JOFA_101102
10
11 #include <functional>
12
13 namespace boost{namespace icl
14 {
15 // naming convention
16 // predicate: n-ary predicate
17 // property: unary predicate
18 // relation: binary predicate
19
20 // Unary predicates
21
22 template <class Type>
23 class property : public std::unary_function<Type,bool>{};
24
25 template <class Type>
26 class member_property : public property<Type>
27 {
28 public:
29 member_property( bool(Type::* pred)()const ): property<Type>(), m_pred(pred){}
30 bool operator()(const Type& x)const { return (x.*m_pred)(); }
31 private:
32 bool(Type::* m_pred)()const;
33 } ;
34
35 // Binary predicates: relations
36
37 template <class LeftT, class RightT>
38 class relation : public std::binary_function<LeftT,RightT,bool>{};
39
40
41 }} // namespace icl boost
42
43 #endif
44