diff --git a/thrust/testing/alignment.cu b/thrust/testing/alignment.cu index e55df2e961..227b258e76 100644 --- a/thrust/testing/alignment.cu +++ b/thrust/testing/alignment.cu @@ -209,72 +209,6 @@ void test_aligned_type() } DECLARE_UNITTEST(test_aligned_type); -template -void test_aligned_storage_instantiation(thrust::detail::true_type /* Align is valid */) -{ - typedef typename thrust::detail::aligned_storage::type type; - ASSERT_GEQUAL(sizeof(type), Len); - ASSERT_EQUAL(THRUST_ALIGNOF(type), Align); - ASSERT_EQUAL(thrust::detail::alignment_of::value, Align); -} - -template -void test_aligned_storage_instantiation(thrust::detail::false_type /* Align is invalid */) -{ - // no-op -- alignment is > max_align_t and MSVC complains loudly. -} - -template -void test_aligned_storage_instantiation() -{ - typedef thrust::detail::integral_constant< - bool, Align <= THRUST_ALIGNOF(thrust::detail::max_align_t)> - ValidAlign; - test_aligned_storage_instantiation(ValidAlign()); -} - -template -void test_aligned_storage_size() -{ - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); - test_aligned_storage_instantiation(); -} - -void test_aligned_storage() -{ - test_aligned_storage_size<1>(); - test_aligned_storage_size<2>(); - test_aligned_storage_size<4>(); - test_aligned_storage_size<8>(); - test_aligned_storage_size<16>(); - test_aligned_storage_size<32>(); - test_aligned_storage_size<64>(); - test_aligned_storage_size<128>(); - test_aligned_storage_size<256>(); - test_aligned_storage_size<512>(); - test_aligned_storage_size<1024>(); - test_aligned_storage_size<2048>(); - test_aligned_storage_size<4096>(); - test_aligned_storage_size<8192>(); - test_aligned_storage_size<16384>(); - - test_aligned_storage_size<3>(); - test_aligned_storage_size<5>(); - test_aligned_storage_size<7>(); - - test_aligned_storage_size<17>(); - test_aligned_storage_size<42>(); - - test_aligned_storage_size<10000>(); -} -DECLARE_UNITTEST(test_aligned_storage); - void test_max_align_t() { ASSERT_GEQUAL( diff --git a/thrust/thrust/detail/alignment.h b/thrust/thrust/detail/alignment.h index 08f73501e0..96fb8436a7 100644 --- a/thrust/thrust/detail/alignment.h +++ b/thrust/thrust/detail/alignment.h @@ -26,7 +26,7 @@ #include // For `std::size_t` and `std::max_align_t`. #if THRUST_CPP_DIALECT >= 2011 - #include // For `std::alignment_of` and `std::aligned_storage`. + #include // For `std::alignment_of`. #endif THRUST_NAMESPACE_BEGIN @@ -154,32 +154,6 @@ struct aligned_type; }; #endif -/// \p aligned_storage provides the nested type `type`, which is a trivial type -/// suitable for use as uninitialized storage for any object whose size is at -/// most `Len` bytes and whose alignment requirement is a divisor of `Align`. -/// -/// The behavior is undefined if `Len` is 0 or `Align` is not a power of 2. -/// -/// It is an implementation of C++11's \p std::aligned_storage. -#if THRUST_CPP_DIALECT >= 2011 - template - using aligned_storage = std::aligned_storage; -#else - template - struct aligned_storage - { - union type - { - unsigned char data[Len]; - // We put this into the union in case the alignment requirement of - // an array of `unsigned char` of length `Len` is greater than - // `Align`. - - typename aligned_type::type align; - }; - }; -#endif - /// \p max_align_t is a trivial type whose alignment requirement is at least as /// strict (as large) as that of every scalar type. ///