Core: Index, VectorMap, ArrayMap now have HasUnlinked method

git-svn-id: svn://ultimatepp.org/upp/trunk@6895 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-02-10 12:55:28 +00:00
parent 5a56d6e987
commit b762a2e1b0
4 changed files with 12 additions and 0 deletions

View file

@ -41,6 +41,7 @@ public:
bool IsUnlinked(int i) const { return hash[i] & UNSIGNED_HIBIT; }
void Unlink(int i);
Vector<int> GetUnlinked() const;
bool HasUnlinked() const { return unlinked >= 0; }
void Remove(int i);
void Remove(int i, int count);
@ -142,6 +143,7 @@ public:
bool IsUnlinked(int i) const { return hash.IsUnlinked(i); }
Vector<int> GetUnlinked() const { return hash.GetUnlinked(); }
void Sweep();
bool HasUnlinked() const { return hash.HasUnlinked(); }
T& Insert(int i, const T& k, unsigned h);
T& Insert(int i, const T& k);

View file

@ -52,6 +52,7 @@ public:
int UnlinkKey(const K& k) { return key.UnlinkKey(k); }
bool IsUnlinked(int i) const { return key.IsUnlinked(i); }
void Sweep();
bool HasUnlinked() const { return key.HasUnlinked(); }
T& Insert(int i, const K& k) { key.Insert(i, k); return value.Insert(i); }
T& Insert(int i, const K& k, const T& x) { key.Insert(i, k); return value.Insert(i, x); }

View file

@ -357,6 +357,11 @@ 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]&]
[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
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

View file

@ -532,6 +532,10 @@ stay in AIndex but are ignored by any Find operations.&]
[s2; Removes all unlinked elements from the container.&]
[s3;%- &]
[s4;%- &]
[s5;:AMap`:`:HasUnlinked`(`)const:%- [@(0.0.255) bool]_[* HasUnlinked]()_[@(0.0.255) const]&]
[s2; Returns true if AMap has any unlinked elements.&]
[s3;%- &]
[s4;%- &]
[s5;:AMap`:`:Insert`(int`,const K`&`):%- [*@4 T][@(0.0.255) `&]_[* Insert]([@(0.0.255) int]_[*@3 i
], [@(0.0.255) const]_[*@4 K][@(0.0.255) `&]_[*@3 k])&]
[s2; Inserts an element with the specified key and default constructed