37 : allowmultiples_(allowmultiples) {}
40 size_type
size()
const {
return vec_.size(); }
41 const T&
operator[](size_type idx)
const {
return (T&)vec_[idx];}
43 size_type
indexOf(
const T&)
const;
57 template <
class U>
void intersect(
const U&);
63 void removeSingle(size_type);
66 std::vector<T>&
vec() {
return vec_.vec(); }
67 const std::vector<T>&
vec()
const {
return vec_.vec(); }
68 T*
arr() {
return size() ? &(*this)[0] : 0; }
69 const T*
arr()
const {
return size() ? &(*this)[0] : 0; }
73 size_type getPos(
const T& )
const;
85 template <
class T>
inline 92 T startval = (*this)[start]; T stopval = (*this)[stop];
93 if ( typ > stopval )
return sz;
95 while ( stopval > startval )
98 return typ>startval ? stop : start;
101 T middleval = (*this)[middle];
103 if ( middleval > typ )
110 startval = middleval;
119 template <
class T>
inline 122 if ( !size() )
return -1;
126 if ( pos>=size() || pos<0 || (*
this)[pos]!=typ )
133 template <
class T>
inline 138 if ( newpos == size() )
140 vec_.push_back( nv );
144 if ( !allowmultiples_ && (*
this)[newpos] == nv )
147 vec_.insert( newpos, nv );
152 template <
class T>
inline 156 if ( !sz )
return *
this;
160 if ( pos == -1 )
return *
this;
162 vec_.removeSingle( pos );
167 template <
class T>
template <
class U>
inline 170 for (
size_type idx=0; idx<size(); idx++ )
172 if ( b.indexOf( (*
this)[idx]) == -1 )
181 template <
class T>
template <
class U>
inline 187 (*
this) += array[idx];
192 template <
class T>
template <
class U>
inline 194 {
return copy(array); }
197 template <
class T>
template <
class U>
inline 202 (*
this) += array[idx];
207 template <
class T>
template <
class U>
inline 212 (*
this) -= array[idx];
217 template <
class T>
inline 223 template <
class T>
inline 226 vec_.remove( p1, p2 );
const T * arr() const
Definition: sortedlist.h:69
std::vector< T > & vec()
Definition: sortedlist.h:66
void removeRange(size_type, size_type)
Definition: sortedlist.h:224
const T & operator[](size_type idx) const
Definition: sortedlist.h:41
bool isPresent(const T &t) const
Definition: sortedlist.h:42
void intersect(const U &)
Definition: sortedlist.h:168
SortedList< T > & operator-=(const T &)
Definition: sortedlist.h:153
bool isEmpty() const
Definition: sortedlist.h:39
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
void removeSingle(size_type)
Definition: sortedlist.h:218
size_type getPos(const T &) const
Definition: sortedlist.h:86
size_type indexOf(const T &) const
Definition: sortedlist.h:120
T * arr()
Definition: sortedlist.h:68
size_type size() const
Definition: sortedlist.h:40
SortedList(bool allowmultiples=true)
Definition: sortedlist.h:36
int size_type
Definition: sortedlist.h:33
T object_type
Definition: sortedlist.h:34
SortedList< T > & operator+=(const T &)
Definition: sortedlist.h:134
SortedList< T > & operator=(const U &)
Definition: sortedlist.h:193
void removeRange(ODSET &inst, size_type start, size_type stop)
Removes a range from the set.
Definition: odset.h:57
SortedList< T > & add(const T &t)
Definition: sortedlist.h:48
void setEmpty()
Definition: sortedlist.h:62
VectorAccess< T, size_type > vec_
Definition: sortedlist.h:79
const std::vector< T > & vec() const
Definition: sortedlist.h:67
bool allowmultiples_
Definition: sortedlist.h:80
A SortedList is a list where all objects are stored in ascending order. The objects should be capable...
Definition: sortedlist.h:29
void erase()
Definition: sortedlist.h:61
void copy(TypeSetBase< T, I > &to, const TypeSetBase< S, I > &from)
Definition: typeset.h:212
#define mClass(module)
Definition: commondefs.h:164
SortedList< T > & copy(const U &)
Definition: sortedlist.h:182