summaryrefslogtreecommitdiff
path: root/abseil-cpp/absl/container/internal/compressed_tuple.h
diff options
context:
space:
mode:
Diffstat (limited to 'abseil-cpp/absl/container/internal/compressed_tuple.h')
-rw-r--r--abseil-cpp/absl/container/internal/compressed_tuple.h26
1 files changed, 4 insertions, 22 deletions
diff --git a/abseil-cpp/absl/container/internal/compressed_tuple.h b/abseil-cpp/absl/container/internal/compressed_tuple.h
index 02bfd03..59e70eb 100644
--- a/abseil-cpp/absl/container/internal/compressed_tuple.h
+++ b/abseil-cpp/absl/container/internal/compressed_tuple.h
@@ -64,19 +64,6 @@ struct Elem<CompressedTuple<B...>, I>
template <typename D, size_t I>
using ElemT = typename Elem<D, I>::type;
-// Use the __is_final intrinsic if available. Where it's not available, classes
-// declared with the 'final' specifier cannot be used as CompressedTuple
-// elements.
-// TODO(sbenza): Replace this with std::is_final in C++14.
-template <typename T>
-constexpr bool IsFinal() {
-#if defined(__clang__) || defined(__GNUC__)
- return __is_final(T);
-#else
- return false;
-#endif
-}
-
// We can't use EBCO on other CompressedTuples because that would mean that we
// derive from multiple Storage<> instantiations with the same I parameter,
// and potentially from multiple identical Storage<> instantiations. So anytime
@@ -86,20 +73,15 @@ struct uses_inheritance {};
template <typename T>
constexpr bool ShouldUseBase() {
- return std::is_class<T>::value && std::is_empty<T>::value && !IsFinal<T>() &&
+ return std::is_class<T>::value && std::is_empty<T>::value &&
+ !std::is_final<T>::value &&
!std::is_base_of<uses_inheritance, T>::value;
}
// The storage class provides two specializations:
// - For empty classes, it stores T as a base class.
// - For everything else, it stores T as a member.
-template <typename T, size_t I,
-#if defined(_MSC_VER)
- bool UseBase =
- ShouldUseBase<typename std::enable_if<true, T>::type>()>
-#else
- bool UseBase = ShouldUseBase<T>()>
-#endif
+template <typename T, size_t I, bool UseBase = ShouldUseBase<T>()>
struct Storage {
T value;
constexpr Storage() = default;
@@ -257,7 +239,7 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
template <int I>
ElemT<I>& get() & {
- return internal_compressed_tuple::Storage<ElemT<I>, I>::get();
+ return StorageT<I>::get();
}
template <int I>