Skip to content

Commit

Permalink
Use newer version gcc
Browse files Browse the repository at this point in the history
* 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 adzerk#9
  • Loading branch information
nickleefly committed Jan 23, 2017
1 parent 2251001 commit d4af94c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [
"<!(node -e \"require('nan')\")"
]
}
]
}
}
5 changes: 0 additions & 5 deletions src/LRUCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@

using namespace v8;

#ifdef __APPLE__
#include <tr1/unordered_map>
#define unordered_map std::tr1::unordered_map
#else
#include <unordered_map>
#define unordered_map std::unordered_map
#endif

class LRUCache : public Nan::ObjectWrap {

Expand Down

0 comments on commit d4af94c

Please sign in to comment.