summaryrefslogtreecommitdiff
path: root/absl/types
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-04-14 13:11:39 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-04-14 13:12:29 -0700
commit387e1bf58c714e15ecba87c4b4673512afecf158 (patch)
tree0c97f1c23f4da245a7dbb092ef32b903bfd5f21c /absl/types
parent2ed3e75e119da83eb2e0c9662ebb3383f0f90f17 (diff)
Optional: Remove workaround for lack of support for inheriting constructors
PiperOrigin-RevId: 524368346 Change-Id: I68b57a1abc8d805aa5cb4b45c5d7449ade231579
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/internal/optional.h52
1 files changed, 0 insertions, 52 deletions
diff --git a/absl/types/internal/optional.h b/absl/types/internal/optional.h
index 6ed0c669..a96d260a 100644
--- a/absl/types/internal/optional.h
+++ b/absl/types/internal/optional.h
@@ -25,34 +25,6 @@
#include "absl/meta/type_traits.h"
#include "absl/utility/utility.h"
-// ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
-//
-// Inheriting constructors is supported in GCC 4.8+, Clang 3.3+ and MSVC 2015.
-// __cpp_inheriting_constructors is a predefined macro and a recommended way to
-// check for this language feature, but GCC doesn't support it until 5.0 and
-// Clang doesn't support it until 3.6.
-// Also, MSVC 2015 has a bug: it doesn't inherit the constexpr template
-// constructor. For example, the following code won't work on MSVC 2015 Update3:
-// struct Base {
-// int t;
-// template <typename T>
-// constexpr Base(T t_) : t(t_) {}
-// };
-// struct Foo : Base {
-// using Base::Base;
-// }
-// constexpr Foo foo(0); // doesn't work on MSVC 2015
-#if defined(__clang__)
-#if __has_feature(cxx_inheriting_constructors)
-#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
-#endif
-#elif (defined(__GNUC__) && \
- (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \
- (__cpp_inheriting_constructors >= 200802) || \
- (defined(_MSC_VER) && _MSC_VER >= 1910)
-#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
-#endif
-
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -145,15 +117,7 @@ template <typename T>
class optional_data_base : public optional_data_dtor_base<T> {
protected:
using base = optional_data_dtor_base<T>;
-#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
using base::base;
-#else
- optional_data_base() = default;
-
- template <typename... Args>
- constexpr explicit optional_data_base(in_place_t t, Args&&... args)
- : base(t, absl::forward<Args>(args)...) {}
-#endif
template <typename... Args>
void construct(Args&&... args) {
@@ -188,27 +152,13 @@ class optional_data;
template <typename T>
class optional_data<T, true> : public optional_data_base<T> {
protected:
-#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
using optional_data_base<T>::optional_data_base;
-#else
- optional_data() = default;
-
- template <typename... Args>
- constexpr explicit optional_data(in_place_t t, Args&&... args)
- : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
-#endif
};
template <typename T>
class optional_data<T, false> : public optional_data_base<T> {
protected:
-#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
using optional_data_base<T>::optional_data_base;
-#else
- template <typename... Args>
- constexpr explicit optional_data(in_place_t t, Args&&... args)
- : optional_data_base<T>(t, absl::forward<Args>(args)...) {}
-#endif
optional_data() = default;
@@ -399,6 +349,4 @@ struct optional_hash_base<T, decltype(std::hash<absl::remove_const_t<T> >()(
ABSL_NAMESPACE_END
} // namespace absl
-#undef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
-
#endif // ABSL_TYPES_INTERNAL_OPTIONAL_H_