From 3ba778f671c98049f814e39247f441f3e2ae74cb Mon Sep 17 00:00:00 2001 From: Davi Reis Date: Fri, 9 Dec 2011 23:57:37 -0200 Subject: [PATCH] Aesthetics, compile on mac with gcc44. --- acinclude.m4 | 2 ++ cxxmph/mph_map.h | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index bde7628..e926f46 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -44,6 +44,7 @@ AC_DEFUN([AC_COMPILE_STDCXX_0X], [ ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -std=c++0x" AC_TRY_COMPILE([ + #include template struct check { @@ -66,6 +67,7 @@ AC_DEFUN([AC_COMPILE_STDCXX_0X], [ ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -std=gnu++0x" AC_TRY_COMPILE([ + #include template struct check { diff --git a/cxxmph/mph_map.h b/cxxmph/mph_map.h index ddb8268..e574c7c 100644 --- a/cxxmph/mph_map.h +++ b/cxxmph/mph_map.h @@ -17,7 +17,10 @@ namespace cxxmph { +using std::pair; +using std::make_pair; using std::unordered_map; +using std::vector; // Save on repetitive typing. #define MPH_MAP_TMPL_SPEC template @@ -29,7 +32,7 @@ class mph_map { public: typedef Key key_type; typedef Data data_type; - typedef std::pair value_type; + typedef pair value_type; typedef HashFcn hasher; typedef EqualKey key_equal; @@ -44,7 +47,7 @@ class mph_map { // For making macros simpler. typedef void void_type; typedef bool bool_type; - typedef std::pair insert_return_type; + typedef pair insert_return_type; mph_map(); ~mph_map(); @@ -58,10 +61,10 @@ class mph_map { void clear(); void erase(iterator pos); void erase(const key_type& k); - std::pair insert(const value_type& x); + pair insert(const value_type& x); iterator find(const key_type& k); const_iterator find(const key_type& k) const; - typedef int32_t my_int32_t; + typedef int32_t my_int32_t; // help macros int32_t index(const key_type& k) const; data_type& operator[](const key_type &k); const data_type& operator[](const key_type &k) const; @@ -109,15 +112,15 @@ MPH_MAP_TMPL_SPEC MPH_MAP_CLASS_SPEC::~mph_map() { MPH_MAP_METHOD_DECL(insert_return_type, insert)(const value_type& x) { iterator it = find(x.first); - if (it != end()) return std::make_pair(it, false); + if (it != end()) return make_pair(it, false); values_.push_back(x); - slack_.insert(std::make_pair(x.first, values_.size() - 1)); + slack_.insert(make_pair(x.first, values_.size() - 1)); if (slack_.size() == index_.size() || (slack_.size() >= 256 && index_.size() == 0)) { pack(); } it = find(x.first); - return std::make_pair(it, true); + return make_pair(it, true); } MPH_MAP_METHOD_DECL(void_type, pack)() { @@ -189,7 +192,7 @@ MPH_MAP_METHOD_DECL(my_int32_t, index)(const key_type& k) const { } MPH_MAP_METHOD_DECL(data_type&, operator[])(const key_type& k) { - return insert(std::make_pair(k, data_type())).first->second; + return insert(make_pair(k, data_type())).first->second; } } // namespace cxxmph