diff options
Diffstat (limited to 'absl/base/casts.h')
-rw-r--r-- | absl/base/casts.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/absl/base/casts.h b/absl/base/casts.h index 00196d20ae77..a381c4276441 100644 --- a/absl/base/casts.h +++ b/absl/base/casts.h @@ -30,28 +30,20 @@ #include "absl/base/internal/identity.h" #include "absl/base/macros.h" +#include "absl/meta/type_traits.h" namespace absl { namespace internal_casts { -// NOTE: Not a fully compliant implementation of `std::is_trivially_copyable`. -// TODO(calabrese) Branch on implementations that directly provide -// `std::is_trivially_copyable`, create a more rigorous workaround, and publicly -// expose in meta/type_traits. -template <class T> -struct is_trivially_copyable - : std::integral_constant< - bool, std::is_destructible<T>::value&& __has_trivial_destructor(T) && - __has_trivial_copy(T) && __has_trivial_assign(T)> {}; - template <class Dest, class Source> struct is_bitcastable - : std::integral_constant<bool, - sizeof(Dest) == sizeof(Source) && - is_trivially_copyable<Source>::value && - is_trivially_copyable<Dest>::value && - std::is_default_constructible<Dest>::value> {}; + : std::integral_constant< + bool, + sizeof(Dest) == sizeof(Source) && + type_traits_internal::is_trivially_copyable<Source>::value && + type_traits_internal::is_trivially_copyable<Dest>::value && + std::is_default_constructible<Dest>::value> {}; } // namespace internal_casts |