From e0ce128d13b2c33a622682cebbdf6492a1bf85c6 Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 17 Jun 2015 21:37:22 +0100 Subject: [PATCH] remove unneeded templates --- octa/internal/hashtable.h | 29 +++++++++++------------------ octa/map.h | 2 -- octa/set.h | 2 -- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/octa/internal/hashtable.h b/octa/internal/hashtable.h index bdd1c06..2c75f27 100644 --- a/octa/internal/hashtable.h +++ b/octa/internal/hashtable.h @@ -328,8 +328,8 @@ namespace detail { return B::get_data(c->value); } - template - octa::Size remove(const U &key) { + template + octa::Size remove(const K &key) { if (!p_len) return 0; octa::Size olen = p_len; octa::Size h = get_hash()(key) & (p_size - 1); @@ -351,8 +351,8 @@ namespace detail { return olen - p_len; } - template - octa::Size count(const U &key) { + template + octa::Size count(const K &key) { if (!p_len) return 0; octa::Size h = get_hash()(key) & (p_size - 1); octa::Size ret = 0; @@ -380,8 +380,7 @@ namespace detail { delete_chunks(p_chunks); } - template - T *access_base(const U &key, octa::Size &h) const { + T *access_base(const K &key, octa::Size &h) const { if (!p_size) return NULL; h = get_hash()(key) & (p_size - 1); for (Chain *c = p_data.first()[h]; c; c = c->next) { @@ -391,14 +390,12 @@ namespace detail { return NULL; } - template - T *access(const U &key) const { + T *access(const K &key) const { octa::Size h; return access_base(key, h); } - template - T &access(const U &key, const V &val) { + T &access(const K &key, const T &val) { octa::Size h; T *found = access_base(key, h); if (found) return *found; @@ -440,8 +437,7 @@ namespace detail { ch), true); } - template - bool find(const U &key, octa::Size &h, Chain *&oc) const { + bool find(const K &key, octa::Size &h, Chain *&oc) const { if (!p_size) return false; h = get_hash()(key) & (p_size - 1); for (Chain *c = p_data.first()[h]; c; c = c->next) { @@ -453,16 +449,14 @@ namespace detail { return false; } - template - Range find(const U &key) { + Range find(const K &key) { octa::Size h; Chain *c; if (find(key, h, c)) return each_from(c, h); return Range(); } - template - ConstRange find(const U &key) const { + ConstRange find(const K &key) const { octa::Size h; Chain *c; 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 max_bucket_count() const { return Size(~0) / sizeof(Chain); } - template - octa::Size bucket(const U &key) const { + octa::Size bucket(const K &key) const { return get_hash()(key) & (p_size - 1); } diff --git a/octa/map.h b/octa/map.h index ff41504..d7d36ed 100644 --- a/octa/map.h +++ b/octa/map.h @@ -52,7 +52,6 @@ private: Base p_table; public: - using Key = K; using Mapped = T; using Size = octa::Size; @@ -247,7 +246,6 @@ private: Base p_table; public: - using Key = K; using Mapped = T; using Size = octa::Size; diff --git a/octa/set.h b/octa/set.h index ce153ac..0971828 100644 --- a/octa/set.h +++ b/octa/set.h @@ -43,7 +43,6 @@ private: Base p_table; public: - using Key = T; using Size = octa::Size; using Difference = octa::Ptrdiff; @@ -214,7 +213,6 @@ private: Base p_table; public: - using Key = T; using Size = octa::Size; using Difference = octa::Ptrdiff;