Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: webrtc/base/template_util.h

Issue 2071003003: Imported Optional from Chromium with some modifications. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/base/optional_unittest.cc ('K') | « webrtc/base/optional_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/template_util.h
diff --git a/webrtc/base/template_util.h b/webrtc/base/template_util.h
index 31464cf35db5d4047a7b8d95cb50246b8a23c0df..e416799857a840f9e61ed1b9b4ecc8852456c72c 100644
--- a/webrtc/base/template_util.h
+++ b/webrtc/base/template_util.h
@@ -13,6 +13,7 @@
#ifndef WEBRTC_BASE_TEMPLATE_UTIL_H_
#define WEBRTC_BASE_TEMPLATE_UTIL_H_
+#include <type_traits> // For is_trivially_destructible
#include <stddef.h> // For size_t.
namespace rtc {
@@ -122,6 +123,27 @@ struct is_class
sizeof(internal::YesType)> {
};
+// This hacks around libstdc++ 4.6 missing stuff in type_traits, while we need
ossu 2016/06/17 14:51:48 These are necessary to implement the partially spe
+// to support it.
+#define CR_GLIBCXX_4_7_0 20120322
+#define CR_GLIBCXX_4_5_4 20120702
+#define CR_GLIBCXX_4_6_4 20121127
+#if defined(__GLIBCXX__) && \
+ (__GLIBCXX__ < CR_GLIBCXX_4_7_0 || __GLIBCXX__ == CR_GLIBCXX_4_5_4 || \
+ __GLIBCXX__ == CR_GLIBCXX_4_6_4)
+#define CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
+#endif
+
+// TODO(crbug.com/554293): Remove this when all platforms have this in the std
+// namespace.
+#if defined(CR_USE_FALLBACKS_FOR_OLD_GLIBCXX)
+template <class T>
+using is_trivially_destructible = std::has_trivial_destructor<T>;
+#else
+template <class T>
+using is_trivially_destructible = std::is_trivially_destructible<T>;
+#endif
+
} // namespace rtc
#endif // WEBRTC_BASE_TEMPLATE_UTIL_H_
« webrtc/base/optional_unittest.cc ('K') | « webrtc/base/optional_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698