|
25 | 25 | #include "absl/meta/type_traits.h"
|
26 | 26 | #include "absl/utility/utility.h"
|
27 | 27 |
|
28 |
| -// ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS |
29 |
| -// |
30 |
| -// Inheriting constructors is supported in GCC 4.8+, Clang 3.3+ and MSVC 2015. |
31 |
| -// __cpp_inheriting_constructors is a predefined macro and a recommended way to |
32 |
| -// check for this language feature, but GCC doesn't support it until 5.0 and |
33 |
| -// Clang doesn't support it until 3.6. |
34 |
| -// Also, MSVC 2015 has a bug: it doesn't inherit the constexpr template |
35 |
| -// constructor. For example, the following code won't work on MSVC 2015 Update3: |
36 |
| -// struct Base { |
37 |
| -// int t; |
38 |
| -// template <typename T> |
39 |
| -// constexpr Base(T t_) : t(t_) {} |
40 |
| -// }; |
41 |
| -// struct Foo : Base { |
42 |
| -// using Base::Base; |
43 |
| -// } |
44 |
| -// constexpr Foo foo(0); // doesn't work on MSVC 2015 |
45 |
| -#if defined(__clang__) |
46 |
| -#if __has_feature(cxx_inheriting_constructors) |
47 |
| -#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1 |
48 |
| -#endif |
49 |
| -#elif (defined(__GNUC__) && \ |
50 |
| - (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \ |
51 |
| - (__cpp_inheriting_constructors >= 200802) || \ |
52 |
| - (defined(_MSC_VER) && _MSC_VER >= 1910) |
53 |
| -#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1 |
54 |
| -#endif |
55 |
| - |
56 | 28 | namespace absl {
|
57 | 29 | ABSL_NAMESPACE_BEGIN
|
58 | 30 |
|
@@ -145,15 +117,7 @@ template <typename T>
|
145 | 117 | class optional_data_base : public optional_data_dtor_base<T> {
|
146 | 118 | protected:
|
147 | 119 | using base = optional_data_dtor_base<T>;
|
148 |
| -#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS |
149 | 120 | using base::base;
|
150 |
| -#else |
151 |
| - optional_data_base() = default; |
152 |
| - |
153 |
| - template <typename... Args> |
154 |
| - constexpr explicit optional_data_base(in_place_t t, Args&&... args) |
155 |
| - : base(t, absl::forward<Args>(args)...) {} |
156 |
| -#endif |
157 | 121 |
|
158 | 122 | template <typename... Args>
|
159 | 123 | void construct(Args&&... args) {
|
@@ -188,27 +152,13 @@ class optional_data;
|
188 | 152 | template <typename T>
|
189 | 153 | class optional_data<T, true> : public optional_data_base<T> {
|
190 | 154 | protected:
|
191 |
| -#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS |
192 | 155 | using optional_data_base<T>::optional_data_base;
|
193 |
| -#else |
194 |
| - optional_data() = default; |
195 |
| - |
196 |
| - template <typename... Args> |
197 |
| - constexpr explicit optional_data(in_place_t t, Args&&... args) |
198 |
| - : optional_data_base<T>(t, absl::forward<Args>(args)...) {} |
199 |
| -#endif |
200 | 156 | };
|
201 | 157 |
|
202 | 158 | template <typename T>
|
203 | 159 | class optional_data<T, false> : public optional_data_base<T> {
|
204 | 160 | protected:
|
205 |
| -#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS |
206 | 161 | using optional_data_base<T>::optional_data_base;
|
207 |
| -#else |
208 |
| - template <typename... Args> |
209 |
| - constexpr explicit optional_data(in_place_t t, Args&&... args) |
210 |
| - : optional_data_base<T>(t, absl::forward<Args>(args)...) {} |
211 |
| -#endif |
212 | 162 |
|
213 | 163 | optional_data() = default;
|
214 | 164 |
|
@@ -399,6 +349,4 @@ struct optional_hash_base<T, decltype(std::hash<absl::remove_const_t<T> >()(
|
399 | 349 | ABSL_NAMESPACE_END
|
400 | 350 | } // namespace absl
|
401 | 351 |
|
402 |
| -#undef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS |
403 |
| - |
404 | 352 | #endif // ABSL_TYPES_INTERNAL_OPTIONAL_H_
|
0 commit comments