From: Attractive Chaos Date: Fri, 27 Dec 2019 23:55:54 +0000 (-0500) Subject: for compatibility with older g++ X-Git-Url: http://www.kaiwu.me/sitemap.xml?a=commitdiff_plain;h=6f73c80c6409d6f91cdf66ec1a002177274da2e7;p=klib.git for compatibility with older g++ --- diff --git a/cpp/khashl.hpp b/cpp/khashl.hpp index 274c91c..b35d349 100644 --- a/cpp/khashl.hpp +++ b/cpp/khashl.hpp @@ -175,17 +175,17 @@ class KHashMap : public KHashSet, typedef KHashSet, KHashMapEq, khint_t> hashset_t; public: khint_t get(const KType &key) const { - bucket_t t = { .key = key }; + bucket_t t = { key, VType() }; return hashset_t::get(t); } khint_t put(const KType &key, int *absent) { - bucket_t t = { .key = key }; + bucket_t t = { key, VType() }; return hashset_t::put(t, absent); } inline KType &key(khint_t i) { return hashset_t::key(i).key; } inline VType &value(khint_t i) { return hashset_t::key(i).val; } inline VType &operator[] (const KType &key) { - bucket_t t = { .key = key }; + bucket_t t = { key, VType() }; return value(hashset_t::put(t)); } }; @@ -212,11 +212,11 @@ class KHashSetCached : public KHashSet, typedef KHashSet, KHashCachedEq, khint_t> hashset_t; public: khint_t get(const KType &key) const { - bucket_t t = { .key = key, .hash = Hash()(key) }; + bucket_t t = { key, Hash()(key) }; return hashset_t::get(t); } khint_t put(const KType &key, int *absent) { - bucket_t t = { .key = key, .hash = Hash()(key) }; + bucket_t t = { key, Hash()(key) }; return hashset_t::put(t, absent); } inline KType &key(khint_t i) { return hashset_t::key(i).key; } @@ -238,17 +238,17 @@ class KHashMapCached : public KHashSet, KHashCachedEq, khint_t> hashset_t; public: khint_t get(const KType &key) const { - bucket_t t = { .key = key, .hash = Hash()(key) }; + bucket_t t = { key, VType(), Hash()(key) }; return hashset_t::get(t); } khint_t put(const KType &key, int *absent) { - bucket_t t = { .key = key, .hash = Hash()(key) }; + bucket_t t = { key, VType(), Hash()(key) }; return hashset_t::put(t, absent); } inline KType &key(khint_t i) { return hashset_t::key(i).key; } inline VType &value(khint_t i) { return hashset_t::key(i).val; } inline VType &operator[] (const KType &key) { - bucket_t t = { .key = key, .hash = Hash()(key) }; + bucket_t t = { key, VType(), Hash()(key) }; return value(hashset_t::put(t)); } };