35 : allowmultiples_(allowmultiples) {}
38 size_type
size()
const {
return vec_.size(); }
39 const T&
operator[](size_type idx)
const {
return (T&)vec_[idx];}
41 size_type
indexOf(
const T&)
const;
55 template <
class U>
void intersect(
const U&);
61 void removeSingle(size_type);
64 std::vector<T>&
vec() {
return vec_.vec(); }
65 const std::vector<T>&
vec()
const {
return vec_.vec(); }
66 T*
arr() {
return size() ? &(*this)[0] : 0; }
67 const T*
arr()
const {
return size() ? &(*this)[0] : 0; }
71 size_type getPos(
const T& )
const;
83 template <
class T>
inline 90 T startval = (*this)[start]; T stopval = (*this)[stop];
91 if ( typ > stopval )
return sz;
93 while ( stopval > startval )
96 return typ>startval ? stop : start;
99 T middleval = (*this)[middle];
101 if ( middleval > typ )
108 startval = middleval;
117 template <
class T>
inline 120 if ( !size() )
return -1;
124 if ( pos>=size() || pos<0 || (*
this)[pos]!=typ )
131 template <
class T>
inline 136 if ( newpos == size() )
138 vec_.push_back( nv );
142 if ( !allowmultiples_ && (*
this)[newpos] == nv )
145 vec_.insert( newpos, nv );
150 template <
class T>
inline 154 if ( !sz )
return *
this;
158 if ( pos == -1 )
return *
this;
160 vec_.removeSingle( pos );
165 template <
class T>
template <
class U>
inline 168 for (
size_type idx=0; idx<size(); idx++ )
170 if ( b.indexOf( (*
this)[idx]) == -1 )
179 template <
class T>
template <
class U>
inline 185 (*
this) += array[idx];
190 template <
class T>
template <
class U>
inline 192 {
return copy(array); }
195 template <
class T>
template <
class U>
inline 200 (*
this) += array[idx];
205 template <
class T>
template <
class U>
inline 210 (*
this) -= array[idx];
215 template <
class T>
inline 221 template <
class T>
inline 224 vec_.remove( p1, p2 );
const T * arr() const
Definition: sortedlist.h:67
std::vector< T > & vec()
Definition: sortedlist.h:64
void removeRange(size_type, size_type)
Definition: sortedlist.h:222
const T & operator[](size_type idx) const
Definition: sortedlist.h:39
bool isPresent(const T &t) const
Definition: sortedlist.h:40
void intersect(const U &)
Definition: sortedlist.h:166
SortedList< T > & operator-=(const T &)
Definition: sortedlist.h:151
bool isEmpty() const
Definition: sortedlist.h:37
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
void removeSingle(size_type)
Definition: sortedlist.h:216
size_type getPos(const T &) const
Definition: sortedlist.h:84
size_type indexOf(const T &) const
Definition: sortedlist.h:118
T * arr()
Definition: sortedlist.h:66
size_type size() const
Definition: sortedlist.h:38
SortedList(bool allowmultiples=true)
Definition: sortedlist.h:34
int size_type
Definition: sortedlist.h:31
T object_type
Definition: sortedlist.h:32
SortedList< T > & operator+=(const T &)
Definition: sortedlist.h:132
SortedList< T > & operator=(const U &)
Definition: sortedlist.h:191
void removeRange(ODSET &inst, size_type start, size_type stop)
Removes a range from the set.
Definition: odset.h:55
SortedList< T > & add(const T &t)
Definition: sortedlist.h:46
void setEmpty()
Definition: sortedlist.h:60
VectorAccess< T, size_type > vec_
Definition: sortedlist.h:77
const std::vector< T > & vec() const
Definition: sortedlist.h:65
bool allowmultiples_
Definition: sortedlist.h:78
A SortedList is a list where all objects are stored in ascending order. The objects should be capable...
Definition: sortedlist.h:27
void erase()
Definition: sortedlist.h:59
void copy(TypeSetBase< T, I > &to, const TypeSetBase< S, I > &from)
Definition: typeset.h:221
#define mClass(module)
Definition: commondefs.h:161
SortedList< T > & copy(const U &)
Definition: sortedlist.h:180