Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Set.h
1 /*
2  * avl::Set class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2013, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_AVL_SET_H_
22 #define ELM_AVL_SET_H_
23 
24 #include <elm/avl/GenTree.h>
25 
26 namespace elm { namespace avl {
27 
28 template <class T, class C = elm::Comparator<T> >
29 class Set: public GenTree<T, IdAdapter<T>, C> {
30 public:
31  static const Set<T, C> null;
32  inline void add(const T& value) { GenTree<T, IdAdapter<T>, C>::set(value); }
33  template <class CC> inline void addAll(const CC& coll)
34  { for(typename CC::Iterator iter(coll); iter; iter++) GenTree<T, IdAdapter<T>, C>::set(iter); }
35 };
36 template <class T, class C> const Set<T, C> Set<T, C>::null;
37 template <class K, class C> inline Set<K, C>& operator+=(Set<K, C> &t, const K& h) { t.add(h); return t; }
38 template <class K, class C> inline Set<K, C>& operator+=(Set<K, C> &t, const Set<K, C>& s) { t.addAll(s); return t; }
39 
40 } } // elm::avl
41 
42 #endif /* ELM_AVL_SET_H_ */
void addAll(const CC &coll)
Definition: Set.h:33
static const Set< T, C > null
Definition: Set.h:31
void add(const T &value)
Definition: Set.h:32
value_t value(CString name, int value)
Definition: rtti.h:40
Definition: Set.h:29
Definition: adapter.h:28
void set(const T &item)
Definition: GenTree.h:203
Set< K, C > & operator+=(Set< K, C > &t, const K &h)
Definition: Set.h:37
Definition: GenTree.h:54