Core: Index, Map: GetHash

git-svn-id: svn://ultimatepp.org/upp/trunk@2824 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-10-27 08:08:50 +00:00
parent efbcb4f8c6
commit c6255d9190
4 changed files with 16 additions and 0 deletions

View file

@ -127,6 +127,8 @@ public:
const T& operator[](int i) const { return key[i]; }
int GetCount() const { return key.GetCount(); }
bool IsEmpty() const { return key.IsEmpty(); }
unsigned GetHash(int i) const { return hash[i]; }
void Clear() { hash.Clear(); key.Clear(); }

View file

@ -75,6 +75,8 @@ public:
void Reserve(int xtra) { value.Reserve(xtra); key.Reserve(xtra); }
int GetAlloc() const { return value.GetAlloc(); }
unsigned GetHash(int i) const { return key.GetHash(i); }
void Drop(int n = 1) { key.Drop(n); value.Drop(n); }
T& Top() { return value.Top(); }
const T& Top() const { return value.Top(); }

View file

@ -308,6 +308,12 @@ tor`[`]]([@(0.0.255) int]_[*@3 i])_[@(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
])_[@(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]()&]
[s2; Removes all elements from AIndex.&]
[s3;%- &]

View file

@ -642,6 +642,12 @@ current capacity, capacity is increased to the required value.&]
[s7; [*/ Return value]-|Capacity of Array.&]
[s3;%- &]
[s4;%- &]
[s5;:AMap`:`: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 AMap, e.g. in the persistent storage.&]
[s3; &]
[s4;%- &]
[s5;:AMap`:`:Drop`(int`):%- [@(0.0.255) void]_[* Drop]([@(0.0.255) int]_[*@3 n]_`=_[@3 1])&]
[s2; Drops the specified number of elements at the end of the AMap.&]
[s7; [*C@3 n]-|Number of elements.&]