aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs/hash.h
diff options
context:
space:
mode:
authorGravatar Peter Kasting <pkasting@google.com>2015-08-27 14:04:04 -0700
committerGravatar Peter Kasting <pkasting@google.com>2015-08-27 19:52:11 -0700
commit5ea84dd335cf19ca3771b3d8c9b2a9b2f4f31031 (patch)
tree68a10aa1e90775031ea05b53cffe1dda26f72eed /src/google/protobuf/stubs/hash.h
parent47210ccd77c88becb9097d59b7765c2d2b41d68e (diff)
Refine check for unordered_{map|set} availability.
It's not enough to check for C++11 language support, as it's possible for projects to enable C++11 language and library features independently (e.g. Chromium currently does this). Instead, explicitly check the library version to see if it is recent enough to include unordered_{map|set}.
Diffstat (limited to 'src/google/protobuf/stubs/hash.h')
-rwxr-xr-xsrc/google/protobuf/stubs/hash.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h
index 9a6b217a..3ff72535 100755
--- a/src/google/protobuf/stubs/hash.h
+++ b/src/google/protobuf/stubs/hash.h
@@ -41,10 +41,10 @@
#define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1
#define GOOGLE_PROTOBUF_HAVE_HASH_SET 1
-// Use C++11 unordered_{map|set} if available. Otherwise, libc++ always support
-// unordered_{map|set}
-#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X) || \
- defined(_LIBCPP_VERSION)
+// Use C++11 unordered_{map|set} if available.
+#if ((__cplusplus >= 201103L) && \
+ ((defined(__GLIBCXX__) && (__GLIBCXX__ > 20090421)) || \
+ (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER >= 11))))
# define GOOGLE_PROTOBUF_HAS_CXX11_HASH
// For XCode >= 4.6: the compiler is clang with libc++.