From 6170a3a28f31479b0aea2d9f9eab2ca8b4ad8ddf Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 7 Apr 2019 21:16:25 -0400 Subject: [PATCH] fix compilation issue with c++11 --- examples/knucleotide.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/knucleotide.cc b/examples/knucleotide.cc index 8938d49..2626c28 100644 --- a/examples/knucleotide.cc +++ b/examples/knucleotide.cc @@ -44,7 +44,7 @@ #include #include #include -#include +#include // ------------------------------------------------------------------ struct Cfg { @@ -123,7 +123,7 @@ private: // ------------------------------------------------------------------ template > -using HashTable = std::unordered_map; +using HashTable = phmap::flat_hash_map; // ------------------------------------------------------------------ template @@ -156,7 +156,7 @@ void Calculate(const Cfg::Data& input, size_t begin, HashTable& table) // ------------------------------------------------------------------ template -auto CalculateInThreads(const Cfg::Data& input) +HashTable CalculateInThreads(const Cfg::Data& input) { HashTable hash_tables[cfg.thread_count]; std::thread threads[cfg.thread_count]; @@ -175,6 +175,7 @@ auto CalculateInThreads(const Cfg::Data& input) for(unsigned i = 1 ; i < cfg.thread_count; ++i) for(auto& j : hash_tables[i]) frequencies[j.first] += j.second; + // return the 'frequency' by move instead of copy. return std::move(frequencies); }