Claw  1.7.3
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@gamned.org
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:
45  public avl<K, Comp>
46  {
47  private:
49  typedef avl<K, Comp> super;
50 
51  public:
55 
57  typedef typename super::value_type value_type;
58 
61 
64 
65  public:
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  ordered_set& operator/=( const ordered_set& that );
70 
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  bool operator<=( const ordered_set& that ) const;
75 
76  ordered_set& intersection( const ordered_set& that );
77  ordered_set& join( const ordered_set& that );
78  ordered_set& difference( const ordered_set& that );
79  ordered_set& symetric_difference( const ordered_set& that );
80 
81  bool contains( const ordered_set& that ) const;
82  bool strictly_contains( const ordered_set& that ) const;
83 
84  private:
86  static Comp s_key_comp;
87 
88  }; // class ordered_set
89  } // namespace math
90 } // namespace claw
91 
92 #include <claw/impl/ordered_set.tpp>
93 
94 #endif // __CLAW_ORDERED_SET_HPP__
claw::math::ordered_set::value_type
super::value_type value_type
The type of the values in the set.
Definition: ordered_set.hpp:57
claw::avl< argument_attributes, std::less< argument_attributes > >::value_type
argument_attributes value_type
The type of the values in the tree.
Definition: avl.hpp:51
claw
This is the main namespace.
Definition: algorithm.hpp:33
claw::avl::const_reference
const typedef K & const_reference
The type of a const reference on the values.
Definition: avl.hpp:63
claw::avl< argument_attributes, std::less< argument_attributes > >::referent_type
argument_attributes referent_type
The type passed to the template.
Definition: avl.hpp:57
claw::avl< argument_attributes, std::less< argument_attributes > >::const_iterator
impl_type::avl_const_iterator const_iterator
The type of the iterator on the values of the tree.
Definition: avl.hpp:66
claw::math::ordered_set
A class to manage sets of ordered items.
Definition: ordered_set.hpp:44
claw::avl
Binary search tree AVL implementation.
Definition: avl.hpp:43
avl.hpp
AVL Binary search tree.
claw::math::ordered_set::const_reference
super::const_reference const_reference
The type of a const reference on the values.
Definition: ordered_set.hpp:63
claw::math::ordered_set::referent_type
super::referent_type referent_type
The type passed to the template.
Definition: ordered_set.hpp:60
claw::math::ordered_set::const_iterator
super::const_iterator const_iterator
The type of the iterator used to access non modifiable values.
Definition: ordered_set.hpp:54