Core: AIndex removed

git-svn-id: svn://ultimatepp.org/upp/trunk@10465 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-11-19 13:19:20 +00:00
parent 54e6cc3df7
commit ab8905daa3
4 changed files with 244 additions and 401 deletions

View file

@ -76,10 +76,10 @@ public:
void Swap(HashBase& b);
};
template <class T, class V>
class AIndex {
template <class T>
class Index : MoveableAndDeepCopyOption<Index<T>> {
protected:
V key;
Vector<T> key;
HashBase hash;
int Find0(const T& x, int i) const {
@ -93,13 +93,13 @@ protected:
void Hash();
public:
unsigned hashfn(const T& x) const { return GetHashValue(x); }
unsigned hashfn(const T& x) const { return GetHashValue(x); }
T& Add(const T& x, unsigned _hash);
T& Add(const T& x);
int FindAdd(const T& key, unsigned _hash);
int FindAdd(const T& key);
AIndex& operator<<(const T& x) { Add(x); return *this; }
Index& operator<<(const T& x) { Add(x); return *this; }
int Put(const T& x, unsigned _hash);
int Put(const T& x);
@ -124,10 +124,6 @@ public:
void Clear() { hash.Clear(); key.Clear(); }
void ClearIndex() { hash.ClearIndex(); }
void Reindex(int n) { hash.Reindex(n); }
void Reindex() { hash.Reindex(); }
void Unlink(int i) { hash.Unlink(i); }
int UnlinkKey(const T& k, unsigned h);
int UnlinkKey(const T& k);
@ -148,6 +144,7 @@ public:
void Trim(int n) { key.SetCount(n); hash.Trim(n); }
void Drop(int n = 1) { key.Drop(n); hash.Drop(n); }
const T& Top() const { return key.Top(); }
T Pop() { T x = B::Top(); B::Drop(); return x; }
void Reserve(int n) { key.Reserve(n); hash.Reserve(n); }
void Shrink() { key.Shrink(); hash.Shrink(); }
@ -165,57 +162,39 @@ public:
template <class B> bool operator<(const B& x) const { return Compare(x) < 0; }
template <class B> bool operator>(const B& x) const { return Compare(x) > 0; }
V PickKeys() pick_ { return pick(key); }
const V& GetKeys() const { return key; }
Vector<T> PickKeys() { Vector<T> r = pick(key); Clear(); return r; }
const Vector<T>& GetKeys() const { return key; }
// Pick assignment & copy. Picked source can only Clear(), ~AIndex(), operator=, operator<<=
Index() {}
Index(Index&& s) : key(pick(s.key)), hash(pick(s.hash)) {}
Index(const Index& s, int) : key(s.key, 0), hash(s.hash, 0) {}
explicit Index(Vector<T>&& s) : key(pick(s)) { Hash(); }
Index(const Vector<T>& s, int) : key(s, 0) { Hash(); }
AIndex& operator=(V&& s);
Index& operator=(Vector<T>&& x) { key = pick(x); Hash(); return *this; }
Index& operator=(Index<T>&& x) { key = pick(x.key); hash = pick(x.hash); return *this; }
typedef ConstIteratorOf<V> ConstIterator;
Index(std::initializer_list<T> init) : key(init) { Hash(); }
typedef ConstIteratorOf<Vector<T>> ConstIterator;
// Standard container interface
ConstIterator begin() const { return key.Begin(); }
ConstIterator end() const { return key.End(); }
void Swap(AIndex& b) { UPP::Swap(hash, b.hash);
friend void Swap(Index& b) { UPP::Swap(hash, b.hash);
UPP::Swap(key, b.key); }
STL_INDEX_COMPATIBILITY(Index<T>)
#ifdef DEPRECATED
AIndex& operator<<=(const V& s);
Index& operator<<=(const Vector<T>& s) { *this = clone(s); return *this; }
typedef T ValueType;
typedef V ValueContainer;
typedef Vector<T> ValueContainer;
ConstIterator GetIter(int pos) const { return key.GetIter(pos); }
void ClearIndex() { hash.ClearIndex(); }
void Reindex(int n) { hash.Reindex(n); }
void Reindex() { hash.Reindex(); }
#endif
protected:
AIndex(V&& s);
AIndex(const V& s, int);
AIndex() {}
AIndex(const AIndex& s, int);
AIndex(std::initializer_list<T> init);
};
template <class T>
class Index : MoveableAndDeepCopyOption< Index<T> >,
public AIndex<T, Vector<T>> {
typedef AIndex<T, Vector<T>> B;
public:
T Pop() { T x = B::Top(); B::Drop(); return x; }
Index() {}
Index(Index&& s) : B(pick(s)) {}
Index(const Index& s, int) : B(s, 1) {}
explicit Index(Vector<T>&& s) : B(pick(s)) {}
Index(const Vector<T>& s, int) : B(s, 1) {}
Index& operator=(Vector<T>&& x) { B::operator=(pick(x)); return *this; }
Index& operator=(Index<T>&& x) { B::operator=(pick(x)); return *this; }
friend void Swap(Index& a, Index& b) { a.B::Swap(b); }
typedef typename B::ConstIterator ConstIterator; // GCC bug (?)
STL_INDEX_COMPATIBILITY(Index<T _cm_ HashFn>)
Index(std::initializer_list<T> init) : B(init) {}
};

View file

@ -92,65 +92,27 @@ inline void HashBase::Unlink(int i)
}
}
template <class T, class V>
AIndex<T, V>::AIndex(const AIndex& s, int)
: key(s.key, 0),
hash(s.hash, 0) {}
template <class T, class V>
void AIndex<T, V>::Hash() {
template <class T>
void Index<T>::Hash() {
hash.Clear();
for(int i = 0; i < key.GetCount(); i++)
hash.Add(hashfn(key[i]));
}
template <class T, class V>
AIndex<T, V>& AIndex<T, V>::operator=(V&& s) {
if(&key != &s) {
key = pick(s);
hash.Clear();
Hash();
}
return *this;
}
template <class T, class V>
AIndex<T, V>& AIndex<T, V>::operator<<=(const V& s) {
key <<= s;
hash.Clear();
Hash();
return *this;
}
template <class T, class V>
AIndex<T, V>::AIndex(V&& s) : key(pick(s)) {
Hash();
}
template <class T, class V>
AIndex<T, V>::AIndex(const V& s, int) : key(s, 1) {
Hash();
}
template <class T, class V>
AIndex<T, V>::AIndex(std::initializer_list<T> init) : key(init)
{
Hash();
}
template <class T, class V>
T& AIndex<T, V>::Add(const T& x, unsigned _hash) {
template <class T>
T& Index<T>::Add(const T& x, unsigned _hash) {
T& t = key.Add(x);
hash.Add(_hash);
return t;
}
template <class T, class V>
T& AIndex<T, V>::Add(const T& x) {
template <class T>
T& Index<T>::Add(const T& x) {
return Add(x, hashfn(x));
}
template <class T, class V>
int AIndex<T, V>::FindAdd(const T& _key, unsigned _hash) {
template <class T>
int Index<T>::FindAdd(const T& _key, unsigned _hash) {
int i = Find(_key, _hash);
if(i >= 0) return i;
i = key.GetCount();
@ -158,8 +120,8 @@ int AIndex<T, V>::FindAdd(const T& _key, unsigned _hash) {
return i;
}
template <class T, class V>
int AIndex<T, V>::Put(const T& x, unsigned _hash)
template <class T>
int Index<T>::Put(const T& x, unsigned _hash)
{
int q = hash.Put(_hash);
if(q < 0) {
@ -171,29 +133,29 @@ int AIndex<T, V>::Put(const T& x, unsigned _hash)
return q;
}
template <class T, class V>
int AIndex<T, V>::Put(const T& x)
template <class T>
int Index<T>::Put(const T& x)
{
return Put(x, hashfn(x));
}
template <class T, class V>
int AIndex<T, V>::FindPut(const T& _key, unsigned _hash)
template <class T>
int Index<T>::FindPut(const T& _key, unsigned _hash)
{
int i = Find(_key, _hash);
if(i >= 0) return i;
return Put(_key, _hash);
}
template <class T, class V>
int AIndex<T, V>::FindPut(const T& key)
template <class T>
int Index<T>::FindPut(const T& key)
{
return FindPut(key, hashfn(key));
}
template <class T, class V>
template <class T>
inline
int AIndex<T, V>::Find(const T& x, unsigned hash_) const {
int Index<T>::Find(const T& x, unsigned hash_) const {
int i0 = hash.Find(hash_);
if(i0 >= 0) {
int i = i0;
@ -206,79 +168,79 @@ int AIndex<T, V>::Find(const T& x, unsigned hash_) const {
return -1;
}
template <class T, class V>
int AIndex<T, V>::Find(const T& x) const {
template <class T>
int Index<T>::Find(const T& x) const {
return Find(x, hashfn(x));
}
template <class T, class V>
int AIndex<T, V>::FindNext(int i) const {
template <class T>
int Index<T>::FindNext(int i) const {
return Find0(key[i], hash.FindNext(i));
}
template <class T, class V>
inline int AIndex<T, V>::FindLast(const T& x, unsigned _hash) const {
template <class T>
inline int Index<T>::FindLast(const T& x, unsigned _hash) const {
return FindB(x, hash.FindLast(_hash));
}
template <class T, class V>
int AIndex<T, V>::FindLast(const T& x) const {
template <class T>
int Index<T>::FindLast(const T& x) const {
return FindLast(x, hashfn(x));
}
template <class T, class V>
int AIndex<T, V>::FindPrev(int i) const {
template <class T>
int Index<T>::FindPrev(int i) const {
return FindB(key[i], hash.FindPrev(i));
}
template <class T, class V>
int AIndex<T, V>::FindAdd(const T& key) {
template <class T>
int Index<T>::FindAdd(const T& key) {
return FindAdd(key, hashfn(key));
}
template <class T, class V>
T& AIndex<T, V>::Set(int i, const T& x, unsigned _hash) {
template <class T>
T& Index<T>::Set(int i, const T& x, unsigned _hash) {
T& t = key[i];
t = x;
hash.Set(i, _hash);
return t;
}
template <class T, class V>
T& AIndex<T, V>::Set(int i, const T& x) {
template <class T>
T& Index<T>::Set(int i, const T& x) {
return Set(i, x, hashfn(x));
}
#ifdef UPP
template <class T, class V>
void AIndex<T, V>::Serialize(Stream& s) {
template <class T>
void Index<T>::Serialize(Stream& s) {
if(s.IsLoading()) ClearIndex();
key.Serialize(s);
hash.Serialize(s);
}
template <class T, class V>
void AIndex<T, V>::Xmlize(XmlIO& xio, const char *itemtag)
template <class T>
void Index<T>::Xmlize(XmlIO& xio, const char *itemtag)
{
XmlizeIndex<T, AIndex<T, V> >(xio, itemtag, *this);
XmlizeIndex<T, Index<T> >(xio, itemtag, *this);
}
template <class T, class V>
void AIndex<T, V>::Jsonize(JsonIO& jio)
template <class T>
void Index<T>::Jsonize(JsonIO& jio)
{
JsonizeIndex<AIndex<T, V>, T>(jio, *this);
JsonizeIndex<Index<T>, T>(jio, *this);
}
template <class T, class V>
String AIndex<T, V>::ToString() const
template <class T>
String Index<T>::ToString() const
{
return AsStringArray(*this);
}
#endif
template <class T, class V>
int AIndex<T, V>::UnlinkKey(const T& k, unsigned h)
template <class T>
int Index<T>::UnlinkKey(const T& k, unsigned h)
{
int n = 0;
int q = hash.Find(h);
@ -293,63 +255,63 @@ int AIndex<T, V>::UnlinkKey(const T& k, unsigned h)
return n;
}
template <class T, class V>
int AIndex<T, V>::UnlinkKey(const T& k)
template <class T>
int Index<T>::UnlinkKey(const T& k)
{
return UnlinkKey(k, hashfn(k));
}
template <class T, class V>
void AIndex<T, V>::Sweep()
template <class T>
void Index<T>::Sweep()
{
Vector<int> b = hash.GetUnlinked();
Sort(b);
Remove(b);
}
template <class T, class V>
T& AIndex<T, V>::Insert(int i, const T& k, unsigned h) {
template <class T>
T& Index<T>::Insert(int i, const T& k, unsigned h) {
key.Insert(i, k);
hash.Insert(i, h);
return key[i];
}
template <class T, class V>
T& AIndex<T, V>::Insert(int i, const T& k) {
template <class T>
T& Index<T>::Insert(int i, const T& k) {
key.Insert(i, k);
hash.Insert(i, hashfn(k));
return key[i];
}
template <class T, class V>
void AIndex<T, V>::Remove(int i)
template <class T>
void Index<T>::Remove(int i)
{
key.Remove(i);
hash.Remove(i);
}
template <class T, class V>
void AIndex<T, V>::Remove(int i, int count)
template <class T>
void Index<T>::Remove(int i, int count)
{
key.Remove(i, count);
hash.Remove(i, count);
}
template <class T, class V>
void AIndex<T, V>::Remove(const int *sorted_list, int count)
template <class T>
void Index<T>::Remove(const int *sorted_list, int count)
{
key.Remove(sorted_list, count);
hash.Remove(sorted_list, count);
}
template <class T, class V>
void AIndex<T, V>::Remove(const Vector<int>& sl)
template <class T>
void Index<T>::Remove(const Vector<int>& sl)
{
Remove(sl, sl.GetCount());
}
template <class T, class V>
int AIndex<T, V>::RemoveKey(const T& k, unsigned h)
template <class T>
int Index<T>::RemoveKey(const T& k, unsigned h)
{
Vector<int> rk;
int q = Find(k, h);
@ -361,8 +323,8 @@ int AIndex<T, V>::RemoveKey(const T& k, unsigned h)
return rk.GetCount();
}
template <class T, class V>
int AIndex<T, V>::RemoveKey(const T& k)
template <class T>
int Index<T>::RemoveKey(const T& k)
{
return RemoveKey(k, hashfn(k));
}

View file

@ -10,33 +10,32 @@ topic "AIndex";
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_}%EN-US
[ {{10000@(113.42.0) [s0; [*@7;4 AIndex]]}}&]
[ {{10000@(113.42.0) [s0; [*@7;4 Index]]}}&]
[s3; &]
[s1;:noref:%- [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 ,
][@(0.0.255)3 class][3 _][*@4;3 V][3 , ][@(0.0.255)3 class][3 _][*@4;3 HashFn][@(0.0.255)3 >]&]
[s1;:AIndex`:`:class:%- [@(0.0.255) class]_[* AIndex]&]
[s8; [*C@4 T]-|Type of elements to store. T must satisfy requirements
for container flavor identified by parameter V and must have
[*C operator`=`=] defined.&]
[s8; [*C@4 V]-|Basic random access container.&]
[s8; [*C@4 HashFn]-|Hashing class. Must have [*C unsigned operator()(const
T`& x)] method returning the hash of x.&]
[s9; This template class adds associative capabilities to basic random
access containers, forming flavors of Index. It is used as base
class for concrete index flavors, [* Index] and [* ArrayIndex].&]
[s1;:noref:%- [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 >]&]
[s1;:Index`:`:class:%- [@(0.0.255) class]_[* Index]&]
[s8; [*@4 T]-|Type of elements stored in Index. T is required to be
[/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ moveable][/ ]and must
have [/^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ deep copy constructor]
and deep copy assignment.&]
[s0; &]
[s0; Like any other NTL container, Index is a [*/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ m
oveable][*/ ]type with [*/^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ pick
and optional deep copy] transfer semantics.&]
[s9; Index adds associative capabilities to Vector.&]
[s9; It allows adding elements at the end of sequence in constant
amortized time like basic random container. Additionally, it
also allows fast retrieval of a position of the element with
specified value. Implementation is based on hash tables. AIndex
specified value. Implementation is based on hash tables. Index
stores hash`-values of elements, so it has no advantage to cache
them externally.&]
[s9; Removing elements from an AIndex poses an interesting problem.
[s9; Removing elements from an Index poses an interesting problem.
While it is possible to simply remove (or insert) an element
at a specified position, such operation has to move a lot of
elements and also invalidates internal hash maps. Thus removing
elements this way is slow, especially when combined with searching.&]
[s9; The solution for this problem is [*/ unlinking] of elements. Unlinked
elements are not removed from the AIndex, instead they are [*/ ignored][/
elements are not removed from the Index, instead they are [*/ ignored][/
]by search operations. Unlinking is a simple, constant time,
fast operation. Further, it is possible to place an element at
the first available unlinked position (rather than to the end
@ -53,72 +52,88 @@ On the other hand, usage scenarios for indexes show that need
for unlinking elements and multi`-key ordering is almost always
disjunct. For the rest of the cases, it is always possible to
restore ordering using [* Sweep] method.&]
[s9; Like any other NTL container, AIndex is [*/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ m
oveable][*/ ]type with [*/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ pick
and optional deep copy] transfer semantics, although these features
are more important in derived concrete index flavors.&]
[s3; &]
[s0; &]
[ {{10000F(128)G(128)@1 [s0; [* Constructor Detail]]}}&]
[s3;%- &]
[s5;:AIndex`:`:AIndex`(`):%- [* AIndex]()&]
[s2; Default constructor.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:AIndex`(const AIndex`&`,int`):%- [* AIndex]([@(0.0.255) const]_[* AIndex][@(0.0.255) `&
]_[*@3 s], [@(0.0.255) int])&]
[s2; Optional deep copy constructor.&]
[s6; -|Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:AIndex`:`:AIndex`(std`:`:initializer`_list`<T`>`):%- [* AIndex]([_^http`:`/`/en`.cppreference`.com`/w`/cpp`/utility`/initializer`_list^ s
td`::initializer`_list]<[*@4 T]>_[*@3 init])&]
[s2; C`+`+ 11 initialization.&]
[s3; &]
[s4; &]
[s5;:AIndex`:`:AIndex`(pick`_ V`&`):%- [* AIndex]([@(0.128.128) pick`_]_[*@4 V][@(0.0.255) `&
]_[*@3 s])&]
[s2; Pick`-constructs [* AIndex] from a basic random access container
[%-*@3 s]. Transfers the source container in short constant time,
but destroys it by picking.&]
[s3; &]
[s4;%- &]
[s5;:AIndex`:`:AIndex`(const V`&`,int`):%- [* AIndex]([@(0.0.255) const]_[*@4 V][@(0.0.255) `&
]_[*@3 s], [@(0.0.255) int])&]
[s2; Deep`-copy constructs AIndex from basic random access container.&]
[s6; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s3; &]
[s0; &]
[ {{10000F(128)G(128)@1 [s0; [* Public Member List]]}}&]
[s3;%- &]
[s5;:AIndex`:`:Add`(const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Add]([@(0.0.255) const
]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s5;:Index`:`:Index`(`):%- [* Index]()&]
[s2; Constructs empty Index.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(Upp`:`:Index`&`&`):%- [* Index]([* Index][@(0.0.255) `&`&]_[*@3 s
])&]
[s2; Pick constructor.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(pick`_ Vector`<T`>`&`):%- [* Index]([@(0.128.128) pick`_]_[_^Vector^ V
ector][@(0.0.255) <][*@4 T][@(0.0.255) >`&]_[*@3 s])&]
[s2; Pick operator. Transfers source Vector to Index in low constant
time, but destroys it by picking.&]
[s7; [*C@3 x]-|Source Vector.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(const Index`&`,int`):%- [* Index]([@(0.0.255) const]_[* Index][@(0.0.255) `&
]_[*@3 s], [@(0.0.255) int])&]
[s2; Optional deep copy constructor.&]
[s6; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s7; [*C@3 s]-|Source Index.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(Upp`:`:Vector`<T`>`&`&`):%- [@(0.0.255) explicit]_[* Index]([_^Upp`:`:Vector^ V
ector]<[*@4 T]>`&`&_[*@3 s])&]
[s2; Pick constructs Index from Vector.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(const Vector`<T`>`&`,int`):%- [* Index]([@(0.0.255) const]_[_^Vector^ V
ector][@(0.0.255) <][*@4 T][@(0.0.255) >`&]_[*@3 s], [@(0.0.255) int])&]
[s2; Deep`-copy constructs Index from Vector.&]
[s6; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s7; [*@3 s]-|Source Vector.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:operator`=`(Upp`:`:Vector`<T`>`&`&`):%- [_^Upp`:`:Index^ Index][@(0.0.255) `&
]_[* operator`=]([_^Upp`:`:Vector^ Vector]<[*@4 T]>`&`&_[*@3 x])&]
[s2; Pick assignment from Vector.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:operator`=`(Upp`:`:Index`<T`>`&`&`):%- [_^Upp`:`:Index^ Index][@(0.0.255) `&
]_[* operator`=]([_^Upp`:`:Index^ Index]<[*@4 T]>`&`&_[*@3 x])&]
[s2; Pick assignment.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(std`:`:initializer`_list`<T`>`):%- [* Index]([_^http`:`/`/en`.cppreference`.com`/w`/cpp`/utility`/initializer`_list^ s
td`::initializer`_list]<[*@4 T]>_[*@3 init])&]
[s6;%- C`+`+ 11 initialization.&]
[s3;%- &]
[s4;%- &]
[s5;:Index`:`:Add`(const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Add]([@(0.0.255) const]_
[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s2; Adds a new element [%-*@3 x] with a precomputed hash value [%-*@3 `_hash].
The performance benefit of this variant is that sometimes you
can compute hash`-value as the part of other process, like fetching
strings from an input stream. Returns a reference to the element.&]
[s6; Requires T to have deep copy constructor.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates iterators to Index.&]
[s6; Invalidates references to Index.&]
[s6; The precomputed [%-@3 `_hash] must be the same as the hash specified
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Add`(const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Add]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
[s5;:Index`:`:Add`(const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Add]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
]_[*@3 x])&]
[s2; Adds a new element [%-*@3 x ]to AIndex. Returns a reference to
[s2; Adds a new element [%-*@3 x ]to Index. Returns a reference to
the element.&]
[s6; Requires T to have deep copy constructor.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates iterators to Index.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Find`(const T`&`,unsigned`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) co
nst]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])_[@(0.0.255) const]&]
[s5;:Index`:`:Find`(const T`&`,unsigned`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) con
st]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])_[@(0.0.255) const]&]
[s2; Returns the position of the first element with value [%-*@3 x]
in AIndex, using a precomputed [%-*@3 `_hash]. If multi`-key ordering
in Index, using a precomputed [%-*@3 `_hash]. If multi`-key ordering
is not broken and more than one element with the same value exists
in AIndex, the lowest position is returned. If the specified
value does not exist in AIndex, a negative number is returned.
@ -127,7 +142,7 @@ Unlinked elements are ignored.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Find`(const T`&`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
[s5;:Index`:`:Find`(const T`&`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
]_[*@3 x])_[@(0.0.255) const]&]
[s2; Returns the position of the first element with value [%-*@3 x]
in AIndex. If multi`-key ordering is not broken and more than
@ -136,7 +151,7 @@ is retrieved. If the specified value does not exist in AIndex,
a negative number is returned. Unlinked elements are ignored.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindNext`(int`)const:%- [@(0.0.255) int]_[* FindNext]([@(0.0.255) int]_[*@3 i])
[s5;:Index`:`:FindNext`(int`)const:%- [@(0.0.255) int]_[* FindNext]([@(0.0.255) int]_[*@3 i])
_[@(0.0.255) const]&]
[s2; Returns the position of the next element with the same value
as the element at [%-*@3 i]. If multi`-key ordering is not broken
@ -147,7 +162,7 @@ When there are no more elements with the required value, a negative
number is returned. Unlinked elements are ignored.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindLast`(const T`&`,unsigned`)const:%- [@(0.0.255) int]_[* FindLast]([@(0.0.255) c
[s5;:Index`:`:FindLast`(const T`&`,unsigned`)const:%- [@(0.0.255) int]_[* FindLast]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])_[@(0.0.255) const]&]
[s2; Returns the position of the last element with value [%-*@3 x]
in AIndex, using a precomputed [%-*@3 `_hash]. If multi`-key ordering
@ -159,8 +174,8 @@ Unlinked elements are ignored.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindLast`(const T`&`)const:%- [@(0.0.255) int]_[* FindLast]([@(0.0.255) cons
t]_[*@4 T][@(0.0.255) `&]_[*@3 x])_[@(0.0.255) const]&]
[s5;:Index`:`:FindLast`(const T`&`)const:%- [@(0.0.255) int]_[* FindLast]([@(0.0.255) const
]_[*@4 T][@(0.0.255) `&]_[*@3 x])_[@(0.0.255) const]&]
[s2; Returns the position of the last element with value [%-*@3 x]
in AIndex. If multi`-key ordering is not broken and more than
one element with the same value exists in AIndex, the greatest
@ -168,7 +183,7 @@ position is retrieved. If element does not exist in AIndex, a
negative number is returned. Unlinked elements are ignored.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindPrev`(int`)const:%- [@(0.0.255) int]_[* FindPrev]([@(0.0.255) int]_[*@3 i])
[s5;:Index`:`:FindPrev`(int`)const:%- [@(0.0.255) int]_[* FindPrev]([@(0.0.255) int]_[*@3 i])
_[@(0.0.255) const]&]
[s2; Returns the position of the previous element with the same value
as the element at [%- _][%-*@3 i]. If multi`-key ordering is not
@ -179,8 +194,8 @@ order). When there are no more elements with required value,
negative number is returned. Unlinked elements are ignored.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindAdd`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* FindAdd]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 key], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s5;:Index`:`:FindAdd`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* FindAdd]([@(0.0.255) co
nst]_[*@4 T][@(0.0.255) `&]_[*@3 key], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s2; Retrieves position of first element with value [%-*@3 key] in
AIndex, using a precomputed [%-*@3 `_hash]. If multi`-key ordering
is not broken and more than one element with the same value exists
@ -194,8 +209,8 @@ newly added element is returned. Unlinked elements are ignored.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindAdd`(const T`&`):%- [@(0.0.255) int]_[* FindAdd]([@(0.0.255) const]_[*@4 T
][@(0.0.255) `&]_[*@3 key])&]
[s5;:Index`:`:FindAdd`(const T`&`):%- [@(0.0.255) int]_[* FindAdd]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
]_[*@3 key])&]
[s2; Retrieves position of first element with value [%-*@3 key] in
AIndex. If multi`-key ordering is not broken and more than one
element with the same value exists in AIndex, lowest position
@ -207,25 +222,14 @@ Unlinked elements are ignored.&]
[s2;%- [*@5;1 Invalidates references to Index.]&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:operator`<`<`(const T`&`):%- AIndex[@(0.0.255) `&]_[* operator<<]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 x])&]
[s2; Operator alternative of [* void Add(const T`& x)]. By returning
reference to AIndex it allows adding multiple elements in a single
expression, thus e.g. allowing to construct a temporary Index
as part of an expression like Foo((Index<int>() << 1 << 2)).&]
[s6; Requires T to have deep copy constructor.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Unlink`(int`):%- [@(0.0.255) void]_[* Unlink]([@(0.0.255) int]_[*@3 i])&]
[s5;:Index`:`:Unlink`(int`):%- [@(0.0.255) void]_[* Unlink]([@(0.0.255) int]_[*@3 i])&]
[s2; Unlinks the element at [%-*@3 i]. The unlinked item stays in AIndex
but is ignored by any Find operation.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Put`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[*@4 T
[s5;:Index`:`:Put`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[*@4 T
][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s2; If there are any unlinked elements in AIndex, one of them is
[s2; If there are any unlinked elements in Index, one of them is
replaced by [%-*@3 x]. If there are no unlinked elements, the element
with the specified value is appended to the end of AIndex using
[* Add]. The position of newly placed element is returned.&]
@ -237,7 +241,7 @@ with the specified value is appended to the end of AIndex using
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Put`(const T`&`):%- [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
[s5;:Index`:`:Put`(const T`&`):%- [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
]_[*@3 x])&]
[s2; If there are any unlinked elements in AIndex, one of them is
replaced by [%-*@3 x]. If there are no unlinked elements, the element
@ -249,8 +253,8 @@ with the specified value is appended to the end of AIndex using
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindPut`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* FindPut]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 key], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s5;:Index`:`:FindPut`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* FindPut]([@(0.0.255) co
nst]_[*@4 T][@(0.0.255) `&]_[*@3 key], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s2; Retrieves the position of the first element with the value [%-*@3 key]
in AIndex, using a precomputed [%-*@3 `_hash]. The precomputed
hash value must be the same as the hash value that would be the
@ -265,8 +269,8 @@ The position of the found or placed element is returned.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:FindPut`(const T`&`):%- [@(0.0.255) int]_[* FindPut]([@(0.0.255) const]_[*@4 T
][@(0.0.255) `&]_[*@3 key])&]
[s5;:Index`:`:FindPut`(const T`&`):%- [@(0.0.255) int]_[* FindPut]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
]_[*@3 key])&]
[s2; Retrieves the position of the first element with value [%-*@3 key]
in AIndex. If the element does not exist in the AIndex, it is
placed to it using [* Put(const T`& x).] The position of the found
@ -277,7 +281,7 @@ or placed element is returned.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Set`(int`,const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Set]([@(0.0.255) i
[s5;:Index`:`:Set`(int`,const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Set]([@(0.0.255) i
nt]_[*@3 i], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_ha
sh])&]
[s2; Replaces the element at the specified position with a new element
@ -291,7 +295,7 @@ same value as the specified one. Returns a reference to the element.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Set`(int`,const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Set]([@(0.0.255) int]_[*@3 i],
[s5;:Index`:`:Set`(int`,const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Set]([@(0.0.255) int]_[*@3 i],
[@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 x])&]
[s2; Replaces the element at the specified position with a new element
with value [%-*@3 x]. Speed of this operation depends on the total
@ -302,34 +306,37 @@ Returns a reference to the element.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:operator`[`]`(int`)const:%- [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[* opera
tor`[`]]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&]
[s5;:Index`:`:operator`[`]`(int`)const:%- [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[* operat
or`[`]]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&]
[s2; Returns the element at the specified position.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetCount`(`)const:%- [@(0.0.255) int]_[* GetCount]()_[@(0.0.255) const]&]
[s5;:Index`:`:GetCount`(`)const:%- [@(0.0.255) int]_[* GetCount]()_[@(0.0.255) const]&]
[s2; Returns number of elements in AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:IsEmpty`(`)const:%- [@(0.0.255) bool]_[* IsEmpty]()_[@(0.0.255) const]&]
[s5;:Upp`:`:Index`:`:begin`(`)const:%- [_^Upp`:`:Index`:`:ConstIterator^ ConstIterator]_
[* begin]()_[@(0.0.255) const]&]
[s5;:Upp`:`:Index`:`:end`(`)const:%- [_^Upp`:`:Index`:`:ConstIterator^ ConstIterator]_[* e
nd]()_[@(0.0.255) const]&]
[s2;%- Standard begin/end methods.&]
[s3;%- &]
[s4;%- &]
[s5;:Index`:`:IsEmpty`(`)const:%- [@(0.0.255) bool]_[* IsEmpty]()_[@(0.0.255) const]&]
[s2; Tests whether AIndex is empty. Same as GetCount() `=`= 0.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetHash`(int`)const:%- [@(0.0.255) unsigned]_[* GetHash]([@(0.0.255) int]_[*@3 i
[s5;:Index`:`:GetHash`(int`)const:%- [@(0.0.255) unsigned]_[* GetHash]([@(0.0.255) int]_[*@3 i
])_[@(0.0.255) const]&]
[s2; Returns a hash of element [%-*@3 i]. This is perhaps only useful
when making the exact copy of Index, e.g. in the persistent storage.&]
[s3; &]
[s4;%- &]
[s5;:AIndex`:`:Clear`(`):%- [@(0.0.255) void]_[* Clear]()&]
[s5;:Index`:`:Clear`(`):%- [@(0.0.255) void]_[* Clear]()&]
[s2; Removes all elements from AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:ClearIndex`(`):%- [@(0.0.255) void]_[* ClearIndex]()&]
[s2; Restores multi`-key ordering.&]
[s3; &]
[s4; &]
[s5;:AIndex`:`:UnlinkKey`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* UnlinkKey]([@(0.0.255) c
[s5;:Index`:`:UnlinkKey`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* UnlinkKey]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 k], [@(0.0.255) unsigned]_[*@3 `_hash])&]
[s2; Unlinks all elements with value [%-*@3 k] using precomputed [%-*@3 `_hash].
Unlinked elements stay in AIndex but are ignored by any Find
@ -339,38 +346,38 @@ that would be result of HashFn.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:UnlinkKey`(const T`&`):%- [@(0.0.255) int]_[* UnlinkKey]([@(0.0.255) const]_
[*@4 T][@(0.0.255) `&]_[*@3 k])&]
[s5;:Index`:`:UnlinkKey`(const T`&`):%- [@(0.0.255) int]_[* UnlinkKey]([@(0.0.255) const]_[*@4 T
][@(0.0.255) `&]_[*@3 k])&]
[s2; Unlinks all elements with value [%-*@3 k]. Unlinked elements remain
in the AIndex but are ignored by any Find operations.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:IsUnlinked`(int`)const:%- [@(0.0.255) bool]_[* IsUnlinked]([@(0.0.255) int]_
[*@3 i])_[@(0.0.255) const]&]
[s5;:Index`:`:IsUnlinked`(int`)const:%- [@(0.0.255) bool]_[* IsUnlinked]([@(0.0.255) int]_[*@3 i
])_[@(0.0.255) const]&]
[s2; Tests whether the element at [%-*@3 i] is unlinked.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetUnlinked`(`)const:%- [_^Vector^ Vector]<[@(0.0.255) int]>_[* GetUnlinked](
[s5;:Index`:`:GetUnlinked`(`)const:%- [_^Vector^ Vector]<[@(0.0.255) int]>_[* GetUnlinked](
)_[@(0.0.255) const]&]
[s2; Returns indicies of all unlinked elements.&]
[s2; Returns indices of all unlinked elements.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Sweep`(`):%- [@(0.0.255) void]_[* Sweep]()&]
[s5;:Index`:`:Sweep`(`):%- [@(0.0.255) void]_[* Sweep]()&]
[s2; Removes all unlinked elements from AIndex. Complexity of the
operation depends on the number of elements in AIndex, not on
the number of unlinked elements. Also restores multi`-key ordering.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:HasUnlinked`(`)const:%- [@(0.0.255) bool]_[* HasUnlinked]()_[@(0.0.255) cons
t]&]
[s5;:Index`:`:HasUnlinked`(`)const:%- [@(0.0.255) bool]_[* HasUnlinked]()_[@(0.0.255) const
]&]
[s2; Returns true of AIndex has any unlinked elements.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Insert`(int`,const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Insert]([@(0.0.255) i
[s5;:Index`:`:Insert`(int`,const T`&`,unsigned`):%- [*@4 T][@(0.0.255) `&]_[* Insert]([@(0.0.255) i
nt]_[*@3 i], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 k], [@(0.0.255) unsigned]_[*@3 h])&]
[s2; Inserts an element with value [%-*@3 k] at the specified position
[%-*@3 i], using a precomputed hash [%-*@3 h]. This is a slow operation.
Returns a reference to the element.&]
[%-*@3 i], using a precomputed hash [%-*@3 h]. This is a slow O(n)
operation. Returns a reference to the element.&]
[s6; Requires T to have deep copy constructor.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates references to Index.&]
@ -378,24 +385,24 @@ Returns a reference to the element.&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Insert`(int`,const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Insert]([@(0.0.255) int]_
[s5;:Index`:`:Insert`(int`,const T`&`):%- [*@4 T][@(0.0.255) `&]_[* Insert]([@(0.0.255) int]_
[*@3 i], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 k])&]
[s2; Inserts an element with value [%-*@3 k] at the specified position
[%-*@3 i]. This is a slow operation. Returns a reference to the
element.&]
[%-*@3 i]. This is a slow O(n) operation. Returns a reference to
the element.&]
[s6; Requires T to have deep copy constructor.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Remove`(int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) int]_[*@3 i])&]
[s5;:Index`:`:Remove`(int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) int]_[*@3 i])&]
[s2; Removes an element at the specified position [%-*@3 i]. This is
a slow O(n) operation.&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Remove`(int`,int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) int]_[*@3 i],
[s5;:Index`:`:Remove`(int`,int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) int]_[*@3 i],
[@(0.0.255) int]_[*@3 count])&]
[s2; Removes [%-*@3 count] elements starting at [%-*@3 i]. This is a
slow O(n) operation.&]
@ -403,8 +410,8 @@ slow O(n) operation.&]
[s6; Invalidates references to Index.&]
[s3; &]
[s4;%- &]
[s5;:AIndex`:`:Remove`(const int`*`,int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) const
]_[@(0.0.255) int]_`*[*@3 sorted`_list], [@(0.0.255) int]_[*@3 count])&]
[s5;:Index`:`:Remove`(const int`*`,int`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) const]_
[@(0.0.255) int]_`*[*@3 sorted`_list], [@(0.0.255) int]_[*@3 count])&]
[s2; Removes multiple elements from AIndex. Time of operation only
slightly depends on the number of removed elements. This is a
slow O(n) operation. [%-*@3 sorted`_list] must point to [%-*@3 count]
@ -413,7 +420,7 @@ positions, sorted in ascending order.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Remove`(const Vector`<int`>`&`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) c
[s5;:Index`:`:Remove`(const Vector`<int`>`&`):%- [@(0.0.255) void]_[* Remove]([@(0.0.255) c
onst]_Vector[@(0.0.255) <int>`&]_[*@3 sorted`_list])&]
[s2; Removes multiple elements from AIndex. Same as Remove(sorted`_list,
sorted`_list.GetCount()).&]
@ -421,7 +428,7 @@ sorted`_list.GetCount()).&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:RemoveKey`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* RemoveKey]([@(0.0.255) c
[s5;:Index`:`:RemoveKey`(const T`&`,unsigned`):%- [@(0.0.255) int]_[* RemoveKey]([@(0.0.255) c
onst]_[*@4 T][@(0.0.255) `&]_[*@3 k], [@(0.0.255) unsigned]_[*@3 h])&]
[s2; Removes all elements with value [%-*@3 k] using a precomputed
hash [%-*@3 h]. Slow O(n).&]
@ -431,81 +438,61 @@ hash [%-*@3 h]. Slow O(n).&]
by HashFn.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:RemoveKey`(const T`&`):%- [@(0.0.255) int]_[* RemoveKey]([@(0.0.255) const]_
[*@4 T][@(0.0.255) `&]_[*@3 k])&]
[s5;:Index`:`:RemoveKey`(const T`&`):%- [@(0.0.255) int]_[* RemoveKey]([@(0.0.255) const]_[*@4 T
][@(0.0.255) `&]_[*@3 k])&]
[s2; Removes all elements with value [%-*@3 k]. Slow O(n).&]
[s6; Invalidates iterators to AIndex.&]
[s6; Invalidates references to Index.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Trim`(int`):%- [@(0.0.255) void]_[* Trim]([@(0.0.255) int]_[*@3 n])&]
[s5;:Index`:`:Trim`(int`):%- [@(0.0.255) void]_[* Trim]([@(0.0.255) int]_[*@3 n])&]
[s2; Reduces the number of elements in AIndex to [%-*@3 n]. Requested
number must be less than or equal to actual number of elements
in AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Drop`(int`):%- [@(0.0.255) void]_[* Drop]([@(0.0.255) int]_[*@3 n]_`=_[@3 1])&]
[s5;:Index`:`:Drop`(int`):%- [@(0.0.255) void]_[* Drop]([@(0.0.255) int]_[*@3 n]_`=_[@3 1])&]
[s2; Drops [%-*@3 n] elements from the end of the AIndex (same as Trim(GetCount()
`- n)).&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Top`(`)const:%- [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[* Top]()_[@(0.0.255) c
[s5;:Index`:`:Top`(`)const:%- [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[* Top]()_[@(0.0.255) c
onst]&]
[s2; Returns a reference to the last element in the AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Reserve`(int`):%- [@(0.0.255) void]_[* Reserve]([@(0.0.255) int]_[*@3 n])&]
[s2; Reserves capacity. If [%-*@3 n] is greater than current capacity,
capacity is increased to the requested value.&]
[s5;:Index`:`:Pop`(`):%- [*@4 T]_[* Pop]()&]
[s2; Drops last element of the Index and returns its value.&]
[s6; Requires T to have deep copy constructor.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Shrink`(`):%- [@(0.0.255) void]_[* Shrink]()&]
[s5;:Index`:`:Reserve`(int`):%- [@(0.0.255) void]_[* Reserve]([@(0.0.255) int]_[*@3 n])&]
[s2; Reserves capacity. If [%-*@3 n] is greater than current capacity,
capacity is increased to the requested value.&]
[s0; &]
[s4;%- &]
[s5;:Index`:`:Shrink`(`):%- [@(0.0.255) void]_[* Shrink]()&]
[s2; Minimizes the memory consumption of AIndex by decreasing the
capacity to the number of elements.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetAlloc`(`)const:%- [@(0.0.255) int]_[* GetAlloc]()_[@(0.0.255) const]&]
[s5;:Index`:`:GetAlloc`(`)const:%- [@(0.0.255) int]_[* GetAlloc]()_[@(0.0.255) const]&]
[s2; Returns the current capacity of AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Serialize`(Stream`&`):%- [@(0.0.255) void]_[* Serialize](Stream[@(0.0.255) `&
[s5;:Index`:`:Serialize`(Stream`&`):%- [@(0.0.255) void]_[* Serialize](Stream[@(0.0.255) `&
]_[*@3 s])&]
[s2; Serializes content of AIndex to/from Stream.&]
[s6; Requires T to have serialization operator defined.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:PickKeys`(`)pick`_:%- [*@4 V]_[* PickKeys]()_[@(0.128.128) pick`_]&]
[s5;:Index`:`:PickKeys`(`):%- [*@4 V]_[* PickKeys]()&]
[s2; Returns a basic random access container of elements. Destroys
AIndex by picking.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetKeys`(`)const:%- [@(0.0.255) const]_[*@4 V][@(0.0.255) `&]_[* GetKeys]()_[@(0.0.255) c
[s5;:Index`:`:GetKeys`(`)const:%- [@(0.0.255) const]_[*@4 V][@(0.0.255) `&]_[* GetKeys]()_[@(0.0.255) c
onst]&]
[s2; Returns a constant reference to basic random access container
of elements.&]
[s3;%- &]
[s4;%- &]
[s5;:Upp`:`:AIndex`:`:operator`=`(V`&`&`):%- [_^Upp`:`:AIndex^ AIndex][@(0.0.255) `&]_[* op
erator`=]([*@4 V][@(0.0.255) `&`&]_[*@3 s])&]
[s2; Assigns basic random access container to AIndex. Transfers the
source container in short constant time, but destroys it by picking.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:Begin`(`)const:%- [_^AIndex`:`:ConstIterator^ ConstIterator]_[* Begin]()_[@(0.0.255) c
onst]&]
[s2; Returns a constant iterator to the first element in AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:End`(`)const:%- [_^AIndex`:`:ConstIterator^ ConstIterator]_[* End]()_[@(0.0.255) c
onst]&]
[s2; Returns a constant iterator to the position just beyond the
last element in AIndex.&]
[s3;%- &]
[s4;%- &]
[s5;:AIndex`:`:GetIter`(int`)const:%- [_^AIndex`:`:ConstIterator^ ConstIterator]_[* GetIt
er]([@(0.0.255) int]_[*@3 pos])_[@(0.0.255) const]&]
[s2; Returns a constant iterator to the element at specified position.
Same as [* Begin() `+ i]. The benefit of this method is that [* pos]
is range checked in debug mode.&]
[s3;%- &]
[s0; ]]

View file

@ -10,38 +10,6 @@ topic "Index";
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_}%EN-US
[ {{10000@(113.42.0) [s0; [*@7;4 Index]]}}&]
[s3; &]
[s1;:noref:%- [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 ,
][@(0.0.255)3 class][3 _][*@4;3 HashFn][3 _`=_StdHash][@(0.0.255)3 <][*@4;3 T][@(0.0.255)3 >][3 _
>]&]
[s1;:Index`:`:class:%- [@(0.0.255) class]_[* Index]_:_[@(0.0.255) private]_[*@3 MoveableAndDee
pCopyOption][@(0.0.255) <]_[* Index][@(0.0.255) <][*@4 T], [*@4 HashFn]_>_>,
[@(0.0.255) public]_[*@3 AIndex][@(0.0.255) <][*@4 T], [_^Vector^ Vector][@(0.0.255) <][*@4 T][@(0.0.255) >
], [*@4 HashFn][@(0.0.255) >]_&]
[s8; [*@4 T]-|Type of elements stored in Index. T is required to be
[/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ moveable][/ ]and must
have [/^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ deep copy constructor]
and deep copy assignment.&]
[s8; [*@4 HashFn]-|Hashing class. Must have unsigned operator()(const
T`& x) method defined, returning hash value for elements. Defaults
to StdHash<T> which requires unsigned GetHashValue(const T`&)
function returning hash value of elements to be defined.&]
[s9; Vector flavor of index. Inherits most of its functionality from
[^topic`:`/`/Core`/src`/AIndex`$en`-us^ AIndex] and adds only members
specific for its flavor.&]
[s9; Like any other NTL container, Index is a [*/^topic`:`/`/Core`/srcdoc`/Moveable`$en`-us^ m
oveable][*/ ]type with [*/^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ pick
and optional deep copy] transfer semantics. Calling methods of
picked Index is logic error with exception of&]
[s0; [C+75 void ][*C+75 operator`=][C+75 (pick`_ Index`& ][*C@3+75 v][C+75 )
][/+75 (defined by composition)]&]
[s0; [C+75 void ][*C+75 operator<<`=][C+75 (const AIndex`& ][*C@3+75 v][C+75 )][+75
][/+75 (defined in AIndex)]&]
[s0; [C+75 void ][*C+75 Clear][C+75 ()]&]
[s0; [C+75 bool ][*C+75 IsPicked][C+75 () const]&]
[s9; Optional deep copy operator is inherited from AIndex class.
Pick operator is implicitly defined by composition.&]
[s0; &]
[s0; [* Base class]&]
[s0; [^topic`:`/`/Core`/src`/AIndex`$en`-us`#AIndex`:`:class^ AIndex<T,
@ -50,62 +18,9 @@ Vector<T>, HashFn>]&]
[s0;%- &]
[ {{10000F(128)G(128)@1 [s0; [* Constructor Detail]]}}&]
[s3;%- &]
[s5;:Index`:`:Index`(`):%- [* Index]()&]
[s2; Constructs empty Index.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(Upp`:`:Index`&`&`):%- [* Index]([* Index][@(0.0.255) `&`&]_[*@3 s
])&]
[s2; Pick constructor.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(pick`_ Vector`<T`>`&`):%- [* Index]([@(0.128.128) pick`_]_[_^Vector^ V
ector][@(0.0.255) <][*@4 T][@(0.0.255) >`&]_[*@3 s])&]
[s2; Pick operator. Transfers source Vector to Index in low constant
time, but destroys it by picking.&]
[s7; [*C@3 x]-|Source Vector.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(const Index`&`,int`):%- [* Index]([@(0.0.255) const]_[* Index][@(0.0.255) `&
]_[*@3 s], [@(0.0.255) int])&]
[s2; Optional deep copy constructor.&]
[s6; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s7; [*C@3 s]-|Source Index.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(Upp`:`:Vector`<T`>`&`&`):%- [@(0.0.255) explicit]_[* Index]([_^Upp`:`:Vector^ V
ector]<[*@4 T]>`&`&_[*@3 s])&]
[s2; Pick constructs Index from Vector.&]
[s3; &]
[s4;%- &]
[s5;:Index`:`:Index`(const Vector`<T`>`&`,int`):%- [* Index]([@(0.0.255) const]_[_^Vector^ V
ector][@(0.0.255) <][*@4 T][@(0.0.255) >`&]_[*@3 s], [@(0.0.255) int])&]
[s2; Deep`-copy constructs Index from Vector.&]
[s6; Requires T to have deep copy constructor or optional deep copy
constructor.&]
[s7; [*@3 s]-|Source Vector.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:operator`=`(Upp`:`:Vector`<T`>`&`&`):%- [_^Upp`:`:Index^ Index][@(0.0.255) `&
]_[* operator`=]([_^Upp`:`:Vector^ Vector]<[*@4 T]>`&`&_[*@3 x])&]
[s2; Pick assignment from Vector.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:operator`=`(Upp`:`:Index`<T`>`&`&`):%- [_^Upp`:`:Index^ Index][@(0.0.255) `&
]_[* operator`=]([_^Upp`:`:Index^ Index]<[*@4 T]>`&`&_[*@3 x])&]
[s2; Pick assignment.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Index`:`:Index`(std`:`:initializer`_list`<T`>`):%- [* Index]([_^http`:`/`/en`.cppreference`.com`/w`/cpp`/utility`/initializer`_list^ s
td`::initializer`_list]<[*@4 T]>_[*@3 init])&]
[s2;%- C`+`+ 11 initialization.&]
[s2;%- &]
[s0; &]
[ {{10000F(128)G(128)@1 [s0; [* Public Member List]]}}&]
[s3;%- &]
[s5;:Index`:`:Pop`(`):%- [*@4 T]_[* Pop]()&]
[s2; Drops last element of the Index and returns its value.&]
[s6; Requires T to have deep copy constructor.&]
[s7; [*/ Return value]-|Value of the dropped element.&]
[s3; &]
[s0; ]]