claw  1.9.0
ordered_set.hpp
Go to the documentation of this file.
1 /*
2  CLAW - a C++ Library Absolutely Wonderful
3 
4  CLAW is a free library without any particular aim but being useful to
5  anyone.
6 
7  Copyright (C) 2005-2011 Julien Jorge
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 
23  contact: julien.jorge@stuff-o-matic.com
24 */
30 #ifndef __CLAW_ORDERED_SET_HPP__
31 #define __CLAW_ORDERED_SET_HPP__
32 
33 #include <claw/avl.hpp>
34 
35 namespace claw
36 {
37  namespace math
38  {
43  template <class K, class Comp = std::less<K> >
44  class ordered_set : public avl<K, Comp>
45  {
46  private:
48  typedef avl<K, Comp> super;
49 
50  public:
54 
56  typedef typename super::value_type value_type;
57 
60 
63 
64  public:
65  ordered_set& operator*=(const ordered_set& that);
66  ordered_set& operator+=(const ordered_set& that);
67  ordered_set& operator-=(const ordered_set& that);
68  ordered_set& operator/=(const ordered_set& that);
69 
70  bool operator>(const ordered_set& that) const;
71  bool operator>=(const ordered_set& that) const;
72  bool operator<(const ordered_set& that) const;
73  bool operator<=(const ordered_set& that) const;
74 
75  ordered_set& intersection(const ordered_set& that);
76  ordered_set& join(const ordered_set& that);
77  ordered_set& difference(const ordered_set& that);
78  ordered_set& symetric_difference(const ordered_set& that);
79 
80  bool contains(const ordered_set& that) const;
81  bool strictly_contains(const ordered_set& that) const;
82 
83  private:
85  static Comp s_key_comp;
86 
87  }; // class ordered_set
88  }
89 }
90 
91 #include <claw/ordered_set.tpp>
92 
93 #endif // __CLAW_ORDERED_SET_HPP__
super::const_reference const_reference
The type of a const reference on the values.
Definition: ordered_set.hpp:62
Binary search tree AVL implementation.
Definition: avl.hpp:43
impl_type::avl_const_iterator const_iterator
The type of the iterator on the values of the tree.
Definition: avl.hpp:66
super::referent_type referent_type
The type passed to the template.
Definition: ordered_set.hpp:59
super::const_iterator const_iterator
The type of the iterator used to access non modifiable values.
Definition: ordered_set.hpp:53
argument_attributes referent_type
The type passed to the template.
Definition: avl.hpp:57
const argument_attributes & const_reference
The type of a const reference on the values.
Definition: avl.hpp:63
AVL Binary search tree.
super::value_type value_type
The type of the values in the set.
Definition: ordered_set.hpp:56
A class to manage sets of ordered items.
Definition: ordered_set.hpp:44
This is the main namespace.
Definition: application.hpp:49
argument_attributes value_type
The type of the values in the tree.
Definition: avl.hpp:51