diff options
author | Jacob Evans <jacob.evans@10gen.com> | 2019-05-30 18:41:56 -0400 |
---|---|---|
committer | Jacob Evans <jacob.evans@10gen.com> | 2019-05-31 12:51:04 -0400 |
commit | 0d36b26ad2f8041f2fcf14ee199b97ee50d7e013 (patch) | |
tree | 4ade6a7a220ea82558331de84101880d8ad6471a /src/mongo/stdx | |
parent | 1ae9c35e4b8ae754fe49075f7f729bccb256e7d0 (diff) | |
download | mongo-0d36b26ad2f8041f2fcf14ee199b97ee50d7e013.tar.gz |
SERVER-41414: Have stdx::variant unconditionally implemented by mpark
Diffstat (limited to 'src/mongo/stdx')
-rw-r--r-- | src/mongo/stdx/variant.h | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/src/mongo/stdx/variant.h b/src/mongo/stdx/variant.h index 458a91b1ea7..c2d396a7c27 100644 --- a/src/mongo/stdx/variant.h +++ b/src/mongo/stdx/variant.h @@ -29,21 +29,10 @@ #pragma once -// Feature detection is messy in C++17 (to be improved in C++20 with the <version> header). -// __cpp_lib_variant is available to check after <variant> is included. Include it if it's available -// (but only if C++17 as MSVS makes it available but emits a message if used). If the variant lib is -// not high enough version, fall back to mpark. -#if __cplusplus >= 201703L && defined(__has_include) && __has_include(<variant>) -#include <variant> -#endif - -#if !defined(__cpp_lib_variant) || __cpp_lib_variant < 201603 #include "third_party/variant-1.3.0/include/mpark/variant.hpp" -#endif -namespace mongo { -namespace stdx { -#if !defined(__cpp_lib_variant) || __cpp_lib_variant < 201603 +namespace mongo::stdx { + using ::mpark::variant; using ::mpark::visit; using ::mpark::holds_alternative; @@ -67,31 +56,4 @@ using ::mpark::operator>=; using ::mpark::monostate; using ::mpark::bad_variant_access; -#else -using ::std::variant; -using ::std::visit; -using ::std::holds_alternative; -using ::std::get; -using ::std::get_if; - -using ::std::variant_size; -using ::std::variant_size_v; -using ::std::variant_alternative; -using ::std::variant_alternative_t; - -constexpr auto variant_npos = ::std::variant_npos; - -using ::std::operator==; -using ::std::operator!=; -using ::std::operator<; -using ::std::operator>; -using ::std::operator<=; -using ::std::operator>=; - -using ::std::monostate; -using ::std::bad_variant_access; - -#endif - -} // namespace stdx -} // namespace mongo +} // namespace mongo::stdx |