From d4af94c3f60137b378f78a9527701992d38b1c28 Mon Sep 17 00:00:00 2001 From: Xiuyu Li Date: Mon, 23 Jan 2017 22:44:09 +0800 Subject: [PATCH] Use newer version gcc * unordered_map is a form of map containter, use unordered_map::find(KeyType key) instead, which returns unordered_map::iterator, essentially pointer tostd::pair< KeyType, ValueType >. Or you can use unordered_map::operator[](KeyType key) to get access to element pointed by the key variable. Note that it will create new element in case it doesn't exist yet. See http://en.cppreference.com/w/cpp/container/unordered_map for more info. * Use newer GCC (at least 4.7) with -std=c++11 option, and you will get standardized std::unordered_map instead of tr1::unordered_map Fix #9 --- binding.gyp | 4 ++-- src/LRUCache.h | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/binding.gyp b/binding.gyp index 84e5c19..2e54d12 100644 --- a/binding.gyp +++ b/binding.gyp @@ -3,10 +3,10 @@ { "target_name": "native", "sources": ["src/native.cc", "src/LRUCache.cc"], - "cflags": [ "-std=c++0x", "-O2" ], + "cflags": [ "-std=c++11", "-O2" ], "include_dirs" : [ " -#define unordered_map std::tr1::unordered_map -#else #include #define unordered_map std::unordered_map -#endif class LRUCache : public Nan::ObjectWrap {