• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace boost{namespace icl
12 {
13     // naming convention
14     // predicate: n-ary predicate
15     // property:  unary predicate
16     // relation:  binary predicate
17 
18     // Unary predicates
19 
20     template <class Type>
21     class property
22     {
23     public:
24         typedef Type argument_type;
25         typedef bool result_type;
26     };
27 
28     template <class Type>
29     class member_property : public property<Type>
30     {
31     public:
member_property(bool (Type::* pred)()const)32         member_property( bool(Type::* pred)()const ): property<Type>(), m_pred(pred){}
operator ()(const Type & x) const33         bool operator()(const Type& x)const { return (x.*m_pred)(); }
34     private:
35         bool(Type::* m_pred)()const;
36     } ;
37 
38     // Binary predicates: relations
39 
40     template <class LeftT, class RightT>
41     class relation
42     {
43     public:
44         typedef LeftT first_argument_type;
45         typedef RightT second_argument_type;
46         typedef bool result_type;
47     };
48 
49 
50 }} // namespace icl boost
51 
52 #endif
53 
54