Browse Source

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>
v6.x
Ehsan Akhgari 9 years ago
committed by cjihrig
parent
commit
63c62cce35
  1. 9
      src/util.h

9
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>;

Loading…
Cancel
Save