mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
overload: Delete obsolete macros for undefining absl::Overload when C++ < 17
PiperOrigin-RevId: 726196763 Change-Id: Iccb643892f8b6ff4f6b456be0274e731f0dcd184
This commit is contained in:
committed by
Copybara-Service
parent
7555944ed6
commit
45f91cb660
@@ -23,8 +23,6 @@
|
||||
// Before using this function, consider whether named function overloads would
|
||||
// be a better design.
|
||||
//
|
||||
// Note: absl::Overload requires C++17.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// std::variant<std::string, int32_t, int64_t> v(int32_t{1});
|
||||
@@ -46,9 +44,6 @@
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
#if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
|
||||
ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
|
||||
|
||||
template <typename... T>
|
||||
struct Overload final : T... {
|
||||
using T::operator()...;
|
||||
@@ -71,21 +66,6 @@ struct Overload final : T... {
|
||||
template <typename... T>
|
||||
Overload(T...) -> Overload<T...>;
|
||||
|
||||
#else
|
||||
|
||||
namespace functional_internal {
|
||||
template <typename T>
|
||||
constexpr bool kDependentFalse = false;
|
||||
}
|
||||
|
||||
template <typename Dependent = int, typename... T>
|
||||
auto Overload(T&&...) {
|
||||
static_assert(functional_internal::kDependentFalse<Dependent>,
|
||||
"Overload is only usable with C++17 or above.");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
|
||||
@@ -18,16 +18,12 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/base/config.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/variant.h"
|
||||
|
||||
#if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
|
||||
ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(OverloadTest, DispatchConsidersTypeWithAutoFallback) {
|
||||
@@ -209,5 +205,3 @@ TEST(OverloadTest, HasConstexprConstructor) {
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user