forked from OctaForge/libostd
remove unneeded templates
parent
281371bb0c
commit
e0ce128d13
|
@ -328,8 +328,8 @@ namespace detail {
|
||||||
return B::get_data(c->value);
|
return B::get_data(c->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<bool multi, typename U>
|
template<bool multi>
|
||||||
octa::Size remove(const U &key) {
|
octa::Size remove(const K &key) {
|
||||||
if (!p_len) return 0;
|
if (!p_len) return 0;
|
||||||
octa::Size olen = p_len;
|
octa::Size olen = p_len;
|
||||||
octa::Size h = get_hash()(key) & (p_size - 1);
|
octa::Size h = get_hash()(key) & (p_size - 1);
|
||||||
|
@ -351,8 +351,8 @@ namespace detail {
|
||||||
return olen - p_len;
|
return olen - p_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<bool multi, typename U>
|
template<bool multi>
|
||||||
octa::Size count(const U &key) {
|
octa::Size count(const K &key) {
|
||||||
if (!p_len) return 0;
|
if (!p_len) return 0;
|
||||||
octa::Size h = get_hash()(key) & (p_size - 1);
|
octa::Size h = get_hash()(key) & (p_size - 1);
|
||||||
octa::Size ret = 0;
|
octa::Size ret = 0;
|
||||||
|
@ -380,8 +380,7 @@ namespace detail {
|
||||||
delete_chunks(p_chunks);
|
delete_chunks(p_chunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
T *access_base(const K &key, octa::Size &h) const {
|
||||||
T *access_base(const U &key, octa::Size &h) const {
|
|
||||||
if (!p_size) return NULL;
|
if (!p_size) return NULL;
|
||||||
h = get_hash()(key) & (p_size - 1);
|
h = get_hash()(key) & (p_size - 1);
|
||||||
for (Chain *c = p_data.first()[h]; c; c = c->next) {
|
for (Chain *c = p_data.first()[h]; c; c = c->next) {
|
||||||
|
@ -391,14 +390,12 @@ namespace detail {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
T *access(const K &key) const {
|
||||||
T *access(const U &key) const {
|
|
||||||
octa::Size h;
|
octa::Size h;
|
||||||
return access_base(key, h);
|
return access_base(key, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U, typename V>
|
T &access(const K &key, const T &val) {
|
||||||
T &access(const U &key, const V &val) {
|
|
||||||
octa::Size h;
|
octa::Size h;
|
||||||
T *found = access_base(key, h);
|
T *found = access_base(key, h);
|
||||||
if (found) return *found;
|
if (found) return *found;
|
||||||
|
@ -440,8 +437,7 @@ namespace detail {
|
||||||
ch), true);
|
ch), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
bool find(const K &key, octa::Size &h, Chain *&oc) const {
|
||||||
bool find(const U &key, octa::Size &h, Chain *&oc) const {
|
|
||||||
if (!p_size) return false;
|
if (!p_size) return false;
|
||||||
h = get_hash()(key) & (p_size - 1);
|
h = get_hash()(key) & (p_size - 1);
|
||||||
for (Chain *c = p_data.first()[h]; c; c = c->next) {
|
for (Chain *c = p_data.first()[h]; c; c = c->next) {
|
||||||
|
@ -453,16 +449,14 @@ namespace detail {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
Range find(const K &key) {
|
||||||
Range find(const U &key) {
|
|
||||||
octa::Size h;
|
octa::Size h;
|
||||||
Chain *c;
|
Chain *c;
|
||||||
if (find(key, h, c)) return each_from(c, h);
|
if (find(key, h, c)) return each_from(c, h);
|
||||||
return Range();
|
return Range();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U>
|
ConstRange find(const K &key) const {
|
||||||
ConstRange find(const U &key) const {
|
|
||||||
octa::Size h;
|
octa::Size h;
|
||||||
Chain *c;
|
Chain *c;
|
||||||
if (find(key, h, c)) return each_from(c, h);
|
if (find(key, h, c)) return each_from(c, h);
|
||||||
|
@ -476,8 +470,7 @@ namespace detail {
|
||||||
octa::Size bucket_count() const { return p_size; }
|
octa::Size bucket_count() const { return p_size; }
|
||||||
octa::Size max_bucket_count() const { return Size(~0) / sizeof(Chain); }
|
octa::Size max_bucket_count() const { return Size(~0) / sizeof(Chain); }
|
||||||
|
|
||||||
template<typename U>
|
octa::Size bucket(const K &key) const {
|
||||||
octa::Size bucket(const U &key) const {
|
|
||||||
return get_hash()(key) & (p_size - 1);
|
return get_hash()(key) & (p_size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ private:
|
||||||
Base p_table;
|
Base p_table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Key = K;
|
using Key = K;
|
||||||
using Mapped = T;
|
using Mapped = T;
|
||||||
using Size = octa::Size;
|
using Size = octa::Size;
|
||||||
|
@ -247,7 +246,6 @@ private:
|
||||||
Base p_table;
|
Base p_table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Key = K;
|
using Key = K;
|
||||||
using Mapped = T;
|
using Mapped = T;
|
||||||
using Size = octa::Size;
|
using Size = octa::Size;
|
||||||
|
|
|
@ -43,7 +43,6 @@ private:
|
||||||
Base p_table;
|
Base p_table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Key = T;
|
using Key = T;
|
||||||
using Size = octa::Size;
|
using Size = octa::Size;
|
||||||
using Difference = octa::Ptrdiff;
|
using Difference = octa::Ptrdiff;
|
||||||
|
@ -214,7 +213,6 @@ private:
|
||||||
Base p_table;
|
Base p_table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Key = T;
|
using Key = T;
|
||||||
using Size = octa::Size;
|
using Size = octa::Size;
|
||||||
using Difference = octa::Ptrdiff;
|
using Difference = octa::Ptrdiff;
|
||||||
|
|
Loading…
Reference in New Issue