Chris@16
|
1 /*-----------------------------------------------------------------------------+
|
Chris@16
|
2 Copyright (c) 2010-2010: Joachim Faulhaber
|
Chris@16
|
3 +------------------------------------------------------------------------------+
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
5 (See accompanying file LICENCE.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 +-----------------------------------------------------------------------------*/
|
Chris@16
|
8 #ifndef BOOST_ICL_PREDICATES_SUB_SUPER_SET_HPP_JOFA_101102
|
Chris@16
|
9 #define BOOST_ICL_PREDICATES_SUB_SUPER_SET_HPP_JOFA_101102
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/icl/type_traits/predicate.hpp>
|
Chris@16
|
12 #include <boost/icl/type_traits/type_to_string.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost{namespace icl
|
Chris@16
|
15 {
|
Chris@16
|
16
|
Chris@16
|
17 /// Functor class template contained_in implements the subset relation.
|
Chris@16
|
18 template<class Type>
|
Chris@16
|
19 struct sub_super_set : public relation<Type,Type>
|
Chris@16
|
20 {
|
Chris@16
|
21 /// Apply the subset relation.
|
Chris@16
|
22 /** <tt>contained_in(sub, super)</tt> is true if <tt>sub</tt>
|
Chris@16
|
23 is contained in <tt>super</tt> */
|
Chris@16
|
24 bool operator()(const Type& sub, const Type& super)const
|
Chris@16
|
25 {
|
Chris@16
|
26 return contains(super, sub);
|
Chris@16
|
27 }
|
Chris@16
|
28 };
|
Chris@16
|
29
|
Chris@16
|
30 template<>
|
Chris@16
|
31 inline std::string unary_template_to_string<icl::sub_super_set>::apply()
|
Chris@16
|
32 { return "C="; }
|
Chris@16
|
33
|
Chris@16
|
34 /// Functor class template <b>contains</b> implements the superset relation.
|
Chris@16
|
35 template<class Type>
|
Chris@16
|
36 struct super_sub_set : public relation<Type,Type>
|
Chris@16
|
37 {
|
Chris@16
|
38 /// Apply the superset relation.
|
Chris@16
|
39 /** <tt>contains(super, sub)</tt> is true if <tt>super</tt> containes
|
Chris@16
|
40 <tt>sub</tt> */
|
Chris@16
|
41 bool operator()(const Type& super, const Type& sub)const
|
Chris@16
|
42 {
|
Chris@16
|
43 return contains(super, sub);
|
Chris@16
|
44 }
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 template<>
|
Chris@16
|
48 inline std::string unary_template_to_string<icl::super_sub_set>::apply()
|
Chris@16
|
49 { return "D="; }
|
Chris@16
|
50
|
Chris@16
|
51 }} // namespace icl boost
|
Chris@16
|
52
|
Chris@16
|
53 #endif
|
Chris@16
|
54
|