aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan@mozilla.com>2016-07-17 18:55:45 -0400
committerAnna Henningsen <anna@addaleax.net>2016-07-27 13:27:08 +0200
commit34d58ce334d1594a5dc1fcec3a3e6727840200c5 (patch)
treec71b420be7c6ebf9018dcf1e8876c0e6110b5766 /src/util.h
parentdee0e3a3336473973eda3a8e0e334e96f587572a (diff)
downloadandroid-node-v8-34d58ce334d1594a5dc1fcec3a3e6727840200c5.tar.gz
android-node-v8-34d58ce334d1594a5dc1fcec3a3e6727840200c5.tar.bz2
android-node-v8-34d58ce334d1594a5dc1fcec3a3e6727840200c5.zip
src: Only use TR1 type_traits on OSX<10.9
Mac OSX 10.9 has switched to using libc++ by default. libc++ provides a C++11 <type_traits> implementation, so we only need to use the TR1 version when targetting OSX 10.8 or 10.7. PR-URL: https://github.com/nodejs/node/pull/7778 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index e57651c3a6..08fb01e5ac 100644
--- a/src/util.h
+++ b/src/util.h
@@ -11,7 +11,12 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef __APPLE__
+// OSX 10.9 defaults to libc++ which provides a C++11 <type_traits> header.
+#if defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090
+#define USE_TR1_TYPE_TRAITS
+#endif
+
+#ifdef USE_TR1_TYPE_TRAITS
#include <tr1/type_traits> // NOLINT(build/c++tr1)
#else
#include <type_traits> // std::remove_reference
@@ -31,7 +36,7 @@ NO_RETURN void Abort();
NO_RETURN void Assert(const char* const (*args)[4]);
void DumpBacktrace(FILE* fp);
-#ifdef __APPLE__
+#ifdef USE_TR1_TYPE_TRAITS
template <typename T> using remove_reference = std::tr1::remove_reference<T>;
#else
template <typename T> using remove_reference = std::remove_reference<T>;