about summary refs log tree commit diff
path: root/absl/base/config.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-04-20T16·16-0700
committerJon Cohen <cohenjon@google.com>2018-04-20T16·30-0400
commitfaf0a1b90374eab44e8956973b0e13febdcf3377 (patch)
tree63a7fd12a50b15c4a321e8373c1bbd975df0b7ba /absl/base/config.h
parent5b535401665cc6aa96d54a5c9b0901153d97210f (diff)
- 551e205ef49682a1cb7e6e0cda46957fbcf88edd Release absl::variant. by Xiaoyi Zhang <zhangxy@google.com>
  - 01c52f640594d073c6e54c47e7853b25522cf085 Update comments in absl::variant (and minor changes to ab... by Tom Manshreck <shreck@google.com>
  - 064465e1e6b158abd8c38fd1942b4fc464b57d6a Documentation change. by Abseil Team <absl-team@google.com>
  - 58df2c8a27e80c9ea21d87c1acee8019246377c9 Relocates SetCountdown and UnsetCountdown to the exceptio... by Abseil Team <absl-team@google.com>
  - fd9d248d0948d472f2543f7fd9c0ae4a1cd60d01 Clarify thread_annotation.h documentation around local va... by Abseil Team <absl-team@google.com>
  - 0d0abaf7f0945ac5f2c5f49e78afe1b326d5aca0 Typo fix in comments. by Abseil Team <absl-team@google.com>
  - 67286d587cbd07508a81e5b8147c245a5b5538b4 Internal change. by Xiaoyi Zhang <zhangxy@google.com>

GitOrigin-RevId: 551e205ef49682a1cb7e6e0cda46957fbcf88edd
Change-Id: I1a343b080187293cb5f892a309618b5712e7aa14
Diffstat (limited to 'absl/base/config.h')
-rw-r--r--absl/base/config.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/absl/base/config.h b/absl/base/config.h
index 500bc8c810b3..3eb24abf2331 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -382,6 +382,19 @@
 #endif
 #endif
 
+// ABSL_HAVE_STD_VARIANT
+//
+// Checks whether C++17 std::optional is available.
+#ifdef ABSL_HAVE_STD_VARIANT
+#error "ABSL_HAVE_STD_VARIANT cannot be directly set."
+#endif
+
+#ifdef __has_include
+#if __has_include(<variant>) && __cplusplus >= 201703L
+#define ABSL_HAVE_STD_VARIANT 1
+#endif
+#endif
+
 // ABSL_HAVE_STD_STRING_VIEW
 //
 // Checks whether C++17 std::string_view is available.
@@ -396,17 +409,18 @@
 #endif
 
 // For MSVC, `__has_include` is supported in VS 2017 15.3, which is later than
-// the support for <optional>, <any>, <string_view>. So we use _MSC_VER to check
-// whether we have VS 2017 RTM (when <optional>, <any>, <string_view> is
-// implemented) or higher.
-// Also, `__cplusplus` is not correctly set by MSVC, so we use `_MSVC_LANG` to
-// check the language version.
+// the support for <optional>, <any>, <string_view>, <variant>. So we use
+// _MSC_VER to check whether we have VS 2017 RTM (when <optional>, <any>,
+// <string_view>, <variant> is implemented) or higher. Also, `__cplusplus` is
+// not correctly set by MSVC, so we use `_MSVC_LANG` to check the language
+// version.
 // TODO(zhangxy): fix tests before enabling aliasing for `std::any`,
 // `std::string_view`.
 #if defined(_MSC_VER) && _MSC_VER >= 1910 && \
     ((defined(_MSVC_LANG) && _MSVC_LANG > 201402) || __cplusplus > 201402)
 // #define ABSL_HAVE_STD_ANY 1
 #define ABSL_HAVE_STD_OPTIONAL 1
+#define ABSL_HAVE_STD_VARIANT 1
 // #define ABSL_HAVE_STD_STRING_VIEW 1
 #endif