File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11#include " hashtable.h"
22#include < iostream>
3+ #ifndef __APPLE__
34#include < unordered_map>
5+ #endif
46
57using namespace v8 ;
68
@@ -91,7 +93,7 @@ Handle<Value> HashTable::Put(const Arguments& args) {
9193
9294 Persistent<Value> persistent = Persistent<Value>::New (value);
9395
94- obj->map .insert (std::pair<std::string, Persistent<Value>>(std::string (*keyStr), persistent));
96+ obj->map .insert (std::pair<std::string, Persistent<Value> >(std::string (*keyStr), persistent));
9597
9698 // Return undefined
9799 return scope.Close (Local<Value>());
Original file line number Diff line number Diff line change 22#define HASHTABLE_H
33
44#include < node.h>
5+ #ifdef __APPLE__
6+ #include < tr1/unordered_map>
7+ #define UNORDERED_MAP_TYPE std::tr1::unordered_map
8+ #else
59#include < unordered_map>
10+ #define UNORDERED_MAP_TYPE std::unordered_map
11+ #endif
612
713class HashTable : public node ::ObjectWrap {
814 public:
@@ -13,7 +19,7 @@ class HashTable : public node::ObjectWrap {
1319 HashTable (size_t buckets);
1420 ~HashTable ();
1521
16- typedef std::unordered_map <std::string,v8::Persistent<v8::Value>> MapType;
22+ typedef UNORDERED_MAP_TYPE <std::string,v8::Persistent<v8::Value> > MapType;
1723 MapType map;
1824
1925 // new HashTable() or new HashTable(buckets)
You can’t perform that action at this time.
0 commit comments