]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_PREDICATES_SUB_SUPER_SET_HPP_JOFA_101102 | |
9 | #define BOOST_ICL_PREDICATES_SUB_SUPER_SET_HPP_JOFA_101102 | |
10 | ||
11 | #include <boost/icl/type_traits/predicate.hpp> | |
12 | #include <boost/icl/type_traits/type_to_string.hpp> | |
13 | ||
14 | namespace boost{namespace icl | |
15 | { | |
16 | ||
17 | /// Functor class template contained_in implements the subset relation. | |
18 | template<class Type> | |
19 | struct sub_super_set : public relation<Type,Type> | |
20 | { | |
21 | /// Apply the subset relation. | |
22 | /** <tt>contained_in(sub, super)</tt> is true if <tt>sub</tt> | |
23 | is contained in <tt>super</tt> */ | |
24 | bool operator()(const Type& sub, const Type& super)const | |
25 | { | |
26 | return contains(super, sub); | |
27 | } | |
28 | }; | |
29 | ||
30 | template<> | |
31 | inline std::string unary_template_to_string<icl::sub_super_set>::apply() | |
32 | { return "C="; } | |
33 | ||
34 | /// Functor class template <b>contains</b> implements the superset relation. | |
35 | template<class Type> | |
36 | struct super_sub_set : public relation<Type,Type> | |
37 | { | |
38 | /// Apply the superset relation. | |
39 | /** <tt>contains(super, sub)</tt> is true if <tt>super</tt> containes | |
40 | <tt>sub</tt> */ | |
41 | bool operator()(const Type& super, const Type& sub)const | |
42 | { | |
43 | return contains(super, sub); | |
44 | } | |
45 | }; | |
46 | ||
47 | template<> | |
48 | inline std::string unary_template_to_string<icl::super_sub_set>::apply() | |
49 | { return "D="; } | |
50 | ||
51 | }} // namespace icl boost | |
52 | ||
53 | #endif | |
54 |