diff --git a/doc/thrust.dox b/doc/thrust.dox index 95ec1a480..fcfdc6c44 100644 --- a/doc/thrust.dox +++ b/doc/thrust.dox @@ -2057,12 +2057,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = THRUST_NOEXCEPT=noexcept \ - "THRUST_DEFAULT={}" \ - "THRUST_NODISCARD=[[nodiscard]]" \ +PREDEFINED = "THRUST_NODISCARD=[[nodiscard]]" \ "THRUST_MR_DEFAULT_ALIGNMENT=alignof(max_align_t)" \ - "THRUST_FINAL=final" \ - "THRUST_OVERRIDE=" \ "cuda_cub=system::cuda" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this diff --git a/testing/adjacent_difference.cu b/testing/adjacent_difference.cu index 5f97ea350..53f5721da 100644 --- a/testing/adjacent_difference.cu +++ b/testing/adjacent_difference.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/testing/allocator_aware_policies.cu b/testing/allocator_aware_policies.cu index aaf841c70..0a737c3ce 100644 --- a/testing/allocator_aware_policies.cu +++ b/testing/allocator_aware_policies.cu @@ -17,14 +17,14 @@ struct test_allocator_t test_allocator_t test_allocator = test_allocator_t(); const test_allocator_t const_test_allocator = test_allocator_t(); -struct test_memory_resource_t THRUST_FINAL : thrust::mr::memory_resource<> +struct test_memory_resource_t final : thrust::mr::memory_resource<> { - void * do_allocate(std::size_t size, std::size_t) THRUST_OVERRIDE + void * do_allocate(std::size_t size, std::size_t) override { return reinterpret_cast(size); } - void do_deallocate(void * ptr, std::size_t size, std::size_t) THRUST_OVERRIDE + void do_deallocate(void * ptr, std::size_t size, std::size_t) override { ASSERT_EQUAL(ptr, reinterpret_cast(size)); } diff --git a/testing/binary_search.cu b/testing/binary_search.cu index 2aceb8645..314c03843 100644 --- a/testing/binary_search.cu +++ b/testing/binary_search.cu @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/testing/binary_search_vector.cu b/testing/binary_search_vector.cu index d9a261c45..244849b20 100644 --- a/testing/binary_search_vector.cu +++ b/testing/binary_search_vector.cu @@ -4,7 +4,7 @@ #include #include #include -#include +#include ////////////////////// diff --git a/testing/copy.cu b/testing/copy.cu index 6359baf79..d99303158 100644 --- a/testing/copy.cu +++ b/testing/copy.cu @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/testing/copy_n.cu b/testing/copy_n.cu index 2003b1069..c421e7672 100644 --- a/testing/copy_n.cu +++ b/testing/copy_n.cu @@ -8,7 +8,7 @@ #include #include #include -#include +#include void TestCopyNFromConstIterator(void) { diff --git a/testing/count.cu b/testing/count.cu index a6021da79..30887cb56 100644 --- a/testing/count.cu +++ b/testing/count.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestCountSimple(void) diff --git a/testing/equal.cu b/testing/equal.cu index ca9f7eb69..7093a88bd 100644 --- a/testing/equal.cu +++ b/testing/equal.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/testing/fill.cu b/testing/fill.cu index 7154b4118..1f1898505 100644 --- a/testing/fill.cu +++ b/testing/fill.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_BEGIN diff --git a/testing/find.cu b/testing/find.cu index 427c8a723..0332fc9bd 100644 --- a/testing/find.cu +++ b/testing/find.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template diff --git a/testing/for_each.cu b/testing/for_each.cu index 8040e5f78..b0b7a25f5 100644 --- a/testing/for_each.cu +++ b/testing/for_each.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/testing/gather.cu b/testing/gather.cu index c164e44b2..8acc8f197 100644 --- a/testing/gather.cu +++ b/testing/gather.cu @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/testing/generate.cu b/testing/generate.cu index fefd7d8e6..ae999b410 100644 --- a/testing/generate.cu +++ b/testing/generate.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_BEGIN diff --git a/testing/inner_product.cu b/testing/inner_product.cu index 1bb897e6d..e6a29a6a1 100644 --- a/testing/inner_product.cu +++ b/testing/inner_product.cu @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/testing/is_partitioned.cu b/testing/is_partitioned.cu index e503f32a3..4fb1ca065 100644 --- a/testing/is_partitioned.cu +++ b/testing/is_partitioned.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template struct is_even diff --git a/testing/is_sorted.cu b/testing/is_sorted.cu index 9edb7ed22..6af9ce450 100644 --- a/testing/is_sorted.cu +++ b/testing/is_sorted.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestIsSortedSimple(void) diff --git a/testing/is_sorted_until.cu b/testing/is_sorted_until.cu index 128395581..2f3f7a9eb 100644 --- a/testing/is_sorted_until.cu +++ b/testing/is_sorted_until.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestIsSortedUntilSimple(void) diff --git a/testing/logical.cu b/testing/logical.cu index 0a2b6edc9..33098b835 100644 --- a/testing/logical.cu +++ b/testing/logical.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template diff --git a/testing/max_element.cu b/testing/max_element.cu index 456239264..772b017dc 100644 --- a/testing/max_element.cu +++ b/testing/max_element.cu @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/testing/merge.cu b/testing/merge.cu index d225edb07..3b7fcb401 100644 --- a/testing/merge.cu +++ b/testing/merge.cu @@ -5,7 +5,7 @@ #include #include #include -#include +#include template void TestMergeSimple(void) diff --git a/testing/merge_by_key.cu b/testing/merge_by_key.cu index 4f504add8..6cee644fd 100644 --- a/testing/merge_by_key.cu +++ b/testing/merge_by_key.cu @@ -4,7 +4,7 @@ #include #include #include -#include +#include template void TestMergeByKeySimple(void) diff --git a/testing/min_element.cu b/testing/min_element.cu index 81fedbdab..109eae601 100644 --- a/testing/min_element.cu +++ b/testing/min_element.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestMinElementSimple(void) diff --git a/testing/minmax_element.cu b/testing/minmax_element.cu index 4a87f5bb4..61dc6cdef 100644 --- a/testing/minmax_element.cu +++ b/testing/minmax_element.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestMinMaxElementSimple(void) diff --git a/testing/mismatch.cu b/testing/mismatch.cu index 9c2ce351a..1b9e3d6b4 100644 --- a/testing/mismatch.cu +++ b/testing/mismatch.cu @@ -1,6 +1,6 @@ #include #include -#include +#include template void TestMismatchSimple(void) diff --git a/testing/mr_disjoint_pool.cu b/testing/mr_disjoint_pool.cu index 8499c6c53..84ffd22fa 100644 --- a/testing/mr_disjoint_pool.cu +++ b/testing/mr_disjoint_pool.cu @@ -50,7 +50,7 @@ struct pointer_traits }; }} -class dummy_resource THRUST_FINAL : public thrust::mr::memory_resource +class dummy_resource final : public thrust::mr::memory_resource { public: dummy_resource() : id_to_allocate(0), id_to_deallocate(0) @@ -63,7 +63,7 @@ public: ASSERT_EQUAL(id_to_deallocate, 0u); } - virtual alloc_id do_allocate(std::size_t bytes, std::size_t alignment) THRUST_OVERRIDE + virtual alloc_id do_allocate(std::size_t bytes, std::size_t alignment) override { ASSERT_EQUAL(static_cast(id_to_allocate), true); @@ -77,7 +77,7 @@ public: return ret; } - virtual void do_deallocate(alloc_id p, std::size_t bytes, std::size_t alignment) THRUST_OVERRIDE + virtual void do_deallocate(alloc_id p, std::size_t bytes, std::size_t alignment) override { ASSERT_EQUAL(p.size, bytes); ASSERT_EQUAL(p.alignment, alignment); diff --git a/testing/mr_pool.cu b/testing/mr_pool.cu index 75b18f038..30c1f18a4 100644 --- a/testing/mr_pool.cu +++ b/testing/mr_pool.cu @@ -108,7 +108,7 @@ struct tracked_pointer : thrust::iterator_facade< } }; -class tracked_resource THRUST_FINAL : public thrust::mr::memory_resource > +class tracked_resource final : public thrust::mr::memory_resource > { public: tracked_resource() : id_to_allocate(0), id_to_deallocate(0) @@ -121,7 +121,7 @@ public: ASSERT_EQUAL(id_to_deallocate, 0u); } - virtual tracked_pointer do_allocate(std::size_t n, std::size_t alignment = THRUST_MR_DEFAULT_ALIGNMENT) THRUST_OVERRIDE + virtual tracked_pointer do_allocate(std::size_t n, std::size_t alignment = THRUST_MR_DEFAULT_ALIGNMENT) override { ASSERT_EQUAL(static_cast(id_to_allocate), true); @@ -136,7 +136,7 @@ public: return ret; } - virtual void do_deallocate(tracked_pointer p, std::size_t n, std::size_t alignment = THRUST_MR_DEFAULT_ALIGNMENT) THRUST_OVERRIDE + virtual void do_deallocate(tracked_pointer p, std::size_t n, std::size_t alignment = THRUST_MR_DEFAULT_ALIGNMENT) override { ASSERT_EQUAL(p.size, n); ASSERT_EQUAL(p.alignment, alignment); diff --git a/testing/partition.cu b/testing/partition.cu index 742560f59..03ca9f804 100644 --- a/testing/partition.cu +++ b/testing/partition.cu @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include template diff --git a/testing/partition_point.cu b/testing/partition_point.cu index bd5a6a8c8..8fabf692f 100644 --- a/testing/partition_point.cu +++ b/testing/partition_point.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template struct is_even diff --git a/testing/reduce.cu b/testing/reduce.cu index cb08bc889..1cbe346c6 100644 --- a/testing/reduce.cu +++ b/testing/reduce.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include template diff --git a/testing/reduce_by_key.cu b/testing/reduce_by_key.cu index f8539c066..54b00b189 100644 --- a/testing/reduce_by_key.cu +++ b/testing/reduce_by_key.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include template struct is_equal_div_10_reduce diff --git a/testing/remove.cu b/testing/remove.cu index 95b679dc7..804fdad8e 100644 --- a/testing/remove.cu +++ b/testing/remove.cu @@ -5,7 +5,7 @@ #include #include #include -#include +#include template diff --git a/testing/replace.cu b/testing/replace.cu index 31e9890bb..d9e130301 100644 --- a/testing/replace.cu +++ b/testing/replace.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template diff --git a/testing/reverse.cu b/testing/reverse.cu index b04e446dc..ba1cea062 100644 --- a/testing/reverse.cu +++ b/testing/reverse.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include typedef unittest::type_list ReverseTypes; diff --git a/testing/scan.cu b/testing/scan.cu index 347b1c126..86bb5e829 100644 --- a/testing/scan.cu +++ b/testing/scan.cu @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/testing/scan_by_key.cu b/testing/scan_by_key.cu index efc48bdb4..a156380bb 100644 --- a/testing/scan_by_key.cu +++ b/testing/scan_by_key.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include diff --git a/testing/scatter.cu b/testing/scatter.cu index ffd56f27c..2d3c0f1a3 100644 --- a/testing/scatter.cu +++ b/testing/scatter.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/testing/sequence.cu b/testing/sequence.cu index cd3e17744..55e91bb02 100644 --- a/testing/sequence.cu +++ b/testing/sequence.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template diff --git a/testing/set_difference.cu b/testing/set_difference.cu index 8ae553fd8..f79457b16 100644 --- a/testing/set_difference.cu +++ b/testing/set_difference.cu @@ -3,7 +3,7 @@ #include #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template diff --git a/testing/sort_by_key.cu b/testing/sort_by_key.cu index 7e8c870eb..8bb1baa5b 100644 --- a/testing/sort_by_key.cu +++ b/testing/sort_by_key.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template #include #include -#include +#include template diff --git a/testing/stable_sort_by_key.cu b/testing/stable_sort_by_key.cu index e3736542d..0b96b5dc0 100644 --- a/testing/stable_sort_by_key.cu +++ b/testing/stable_sort_by_key.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template diff --git a/testing/swap_ranges.cu b/testing/swap_ranges.cu index 843c66240..691f76e52 100644 --- a/testing/swap_ranges.cu +++ b/testing/swap_ranges.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include diff --git a/testing/tabulate.cu b/testing/tabulate.cu index 25c6e40ac..4aa3fedfd 100644 --- a/testing/tabulate.cu +++ b/testing/tabulate.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include template diff --git a/testing/transform.cu b/testing/transform.cu index 7e3c3e60f..ebaa87b08 100644 --- a/testing/transform.cu +++ b/testing/transform.cu @@ -5,7 +5,7 @@ #include #include #include -#include +#include template diff --git a/testing/transform_reduce.cu b/testing/transform_reduce.cu index 3ff3159d6..723abedb9 100644 --- a/testing/transform_reduce.cu +++ b/testing/transform_reduce.cu @@ -3,7 +3,7 @@ #include #include -#include +#include template #include #include -#include +#include template #include #include -#include +#include template diff --git a/testing/uninitialized_fill.cu b/testing/uninitialized_fill.cu index 5e0d53c72..d7c2b29f1 100644 --- a/testing/uninitialized_fill.cu +++ b/testing/uninitialized_fill.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include template diff --git a/testing/unique.cu b/testing/unique.cu index 8073832df..a61a98565 100644 --- a/testing/unique.cu +++ b/testing/unique.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include template diff --git a/testing/unique_by_key.cu b/testing/unique_by_key.cu index 76073e0ca..442ed2626 100644 --- a/testing/unique_by_key.cu +++ b/testing/unique_by_key.cu @@ -2,7 +2,7 @@ #include #include #include -#include +#include template -#if THRUST_CPP_DIALECT >= 2011 -# include -#endif +#include namespace thrust { @@ -20,7 +18,7 @@ namespace thrust */ template __host__ __device__ -T* addressof(T& arg) +T* addressof(T& arg) { return reinterpret_cast( &const_cast(reinterpret_cast(arg)) diff --git a/thrust/allocate_unique.h b/thrust/allocate_unique.h index 8b1562b0e..f1ef576d0 100644 --- a/thrust/allocate_unique.h +++ b/thrust/allocate_unique.h @@ -6,10 +6,6 @@ #pragma once #include -#include - -#if THRUST_CPP_DIALECT >= 2011 - #include #include #include @@ -246,7 +242,7 @@ struct array_allocator_delete final allocator_type alloc_; std::size_t count_; }; - + template using uninitialized_array_allocator_delete = array_allocator_delete; @@ -440,5 +436,3 @@ uninitialized_allocate_unique_n( } // end namespace thrust -#endif // THRUST_CPP_DIALECT >= 2011 - diff --git a/thrust/async/copy.h b/thrust/async/copy.h index c3d7b3bdd..3ac347bb8 100644 --- a/thrust/async/copy.h +++ b/thrust/async/copy.h @@ -21,11 +21,6 @@ #pragma once #include -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) - #include #include #include @@ -146,5 +141,3 @@ THRUST_INLINE_CONSTANT copy_detail::copy_fn copy{}; } // end namespace thrust -#endif - diff --git a/thrust/async/for_each.h b/thrust/async/for_each.h index fc1814bdc..ab93caf88 100644 --- a/thrust/async/for_each.h +++ b/thrust/async/for_each.h @@ -21,11 +21,6 @@ #pragma once #include -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) - #include #include #include @@ -57,13 +52,13 @@ async_for_each( , "this algorithm is not implemented for the specified system" ); return {}; -} +} } // namespace unimplemented namespace for_each_detail { - + using thrust::async::unimplemented::async_for_each; struct for_each_fn final @@ -76,7 +71,7 @@ struct for_each_fn final static auto call( thrust::detail::execution_policy_base const& exec , ForwardIt&& first, Sentinel&& last - , UnaryFunction&& f + , UnaryFunction&& f ) // ADL dispatch. THRUST_DECLTYPE_RETURNS( @@ -89,7 +84,7 @@ struct for_each_fn final template __host__ - static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f) + static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f) THRUST_DECLTYPE_RETURNS( for_each_fn::call( thrust::detail::select_system( @@ -116,5 +111,3 @@ THRUST_INLINE_CONSTANT for_each_detail::for_each_fn for_each{}; } // end namespace thrust -#endif - diff --git a/thrust/async/reduce.h b/thrust/async/reduce.h index a37499584..5b045fbca 100644 --- a/thrust/async/reduce.h +++ b/thrust/async/reduce.h @@ -21,11 +21,6 @@ #pragma once #include -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) - #include #include #include @@ -48,7 +43,7 @@ template < typename DerivedPolicy , typename ForwardIt, typename Sentinel, typename T, typename BinaryOp > -__host__ +__host__ future async_reduce( thrust::execution_policy&, ForwardIt, Sentinel, T, BinaryOp @@ -59,7 +54,7 @@ async_reduce( , "this algorithm is not implemented for the specified system" ); return {}; -} +} } // namespace unimplemented @@ -208,7 +203,7 @@ struct reduce_fn final ) template - THRUST_NODISCARD __host__ + THRUST_NODISCARD __host__ auto operator()(Args&&... args) const THRUST_DECLTYPE_RETURNS( call(THRUST_FWD(args)...) @@ -241,7 +236,7 @@ async_reduce_into( , "this algorithm is not implemented for the specified system" ); return {}; -} +} } // namespace unimplemented @@ -423,7 +418,7 @@ struct reduce_into_fn final ) template - THRUST_NODISCARD __host__ + THRUST_NODISCARD __host__ auto operator()(Args&&... args) const THRUST_DECLTYPE_RETURNS( call(THRUST_FWD(args)...) @@ -438,5 +433,3 @@ THRUST_INLINE_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{}; } // end namespace thrust -#endif - diff --git a/thrust/async/sort.h b/thrust/async/sort.h index 0b6a55830..5388e49c1 100644 --- a/thrust/async/sort.h +++ b/thrust/async/sort.h @@ -21,11 +21,6 @@ #pragma once #include -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) - #include #include #include @@ -48,10 +43,10 @@ template < typename DerivedPolicy , typename ForwardIt, typename Sentinel, typename StrictWeakOrdering > -__host__ +__host__ event async_stable_sort( - thrust::execution_policy& + thrust::execution_policy& , ForwardIt, Sentinel, StrictWeakOrdering ) { @@ -60,7 +55,7 @@ async_stable_sort( , "this algorithm is not implemented for the specified system" ); return {}; -} +} } // namespace unimplemented @@ -75,7 +70,7 @@ struct stable_sort_fn final typename DerivedPolicy , typename ForwardIt, typename Sentinel, typename StrictWeakOrdering > - __host__ + __host__ static auto call( thrust::detail::execution_policy_base const& exec , ForwardIt&& first, Sentinel&& last @@ -94,7 +89,7 @@ struct stable_sort_fn final typename DerivedPolicy , typename ForwardIt, typename Sentinel > - __host__ + __host__ static auto call( thrust::detail::execution_policy_base const& exec , ForwardIt&& first, Sentinel&& last @@ -111,8 +106,8 @@ struct stable_sort_fn final ) template - __host__ - static auto call(ForwardIt&& first, Sentinel&& last, StrictWeakOrdering&& comp) + __host__ + static auto call(ForwardIt&& first, Sentinel&& last, StrictWeakOrdering&& comp) THRUST_DECLTYPE_RETURNS( stable_sort_fn::call( thrust::detail::select_system( @@ -124,8 +119,8 @@ struct stable_sort_fn final ) template - __host__ - static auto call(ForwardIt&& first, Sentinel&& last) + __host__ + static auto call(ForwardIt&& first, Sentinel&& last) THRUST_DECLTYPE_RETURNS( stable_sort_fn::call( THRUST_FWD(first), THRUST_FWD(last) @@ -136,7 +131,7 @@ struct stable_sort_fn final ) template - THRUST_NODISCARD __host__ + THRUST_NODISCARD __host__ auto operator()(Args&&... args) const THRUST_DECLTYPE_RETURNS( call(THRUST_FWD(args)...) @@ -154,7 +149,7 @@ template < typename DerivedPolicy , typename ForwardIt, typename Sentinel, typename StrictWeakOrdering > -__host__ +__host__ event async_sort( thrust::execution_policy& exec @@ -165,7 +160,7 @@ async_sort( thrust::detail::derived_cast(exec) , THRUST_FWD(first), THRUST_FWD(last), THRUST_FWD(comp) ); -} +} } // namespace fallback @@ -180,7 +175,7 @@ struct sort_fn final typename DerivedPolicy , typename ForwardIt, typename Sentinel, typename StrictWeakOrdering > - __host__ + __host__ static auto call( thrust::detail::execution_policy_base const& exec , ForwardIt&& first, Sentinel&& last @@ -199,7 +194,7 @@ struct sort_fn final typename DerivedPolicy , typename ForwardIt, typename Sentinel > - __host__ + __host__ static auto call3( thrust::detail::execution_policy_base const& exec , ForwardIt&& first, Sentinel&& last @@ -216,7 +211,7 @@ struct sort_fn final ) template - __host__ + __host__ static auto call3(ForwardIt&& first, Sentinel&& last, StrictWeakOrdering&& comp, thrust::false_type) @@ -242,8 +237,8 @@ struct sort_fn final ) template - __host__ - static auto call(ForwardIt&& first, Sentinel&& last) + __host__ + static auto call(ForwardIt&& first, Sentinel&& last) THRUST_DECLTYPE_RETURNS( sort_fn::call( thrust::detail::select_system( @@ -257,7 +252,7 @@ struct sort_fn final ) template - THRUST_NODISCARD __host__ + THRUST_NODISCARD __host__ auto operator()(Args&&... args) const THRUST_DECLTYPE_RETURNS( call(THRUST_FWD(args)...) @@ -272,5 +267,4 @@ THRUST_INLINE_CONSTANT sort_detail::sort_fn sort{}; } // end namespace thrust -#endif diff --git a/thrust/async/transform.h b/thrust/async/transform.h index 3011a5df7..8842baa2c 100644 --- a/thrust/async/transform.h +++ b/thrust/async/transform.h @@ -21,11 +21,6 @@ #pragma once #include -#include -#include - -#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) - #include #include #include @@ -131,5 +126,3 @@ THRUST_INLINE_CONSTANT transform_detail::transform_fn transform{}; } // end namespace thrust -#endif - diff --git a/thrust/complex.h b/thrust/complex.h index badacb467..544acba6b 100644 --- a/thrust/complex.h +++ b/thrust/complex.h @@ -28,21 +28,15 @@ #include #include -#if THRUST_CPP_DIALECT >= 2011 -# define THRUST_STD_COMPLEX_REAL(z) \ - reinterpret_cast< \ - const typename thrust::detail::remove_reference::type::value_type (&)[2] \ - >(z)[0] -# define THRUST_STD_COMPLEX_IMAG(z) \ - reinterpret_cast< \ - const typename thrust::detail::remove_reference::type::value_type (&)[2] \ - >(z)[1] -# define THRUST_STD_COMPLEX_DEVICE __device__ -#else -# define THRUST_STD_COMPLEX_REAL(z) (z).real() -# define THRUST_STD_COMPLEX_IMAG(z) (z).imag() -# define THRUST_STD_COMPLEX_DEVICE -#endif +#define THRUST_STD_COMPLEX_REAL(z) \ + reinterpret_cast< \ + const typename thrust::detail::remove_reference::type::value_type (&)[2] \ + >(z)[0] +#define THRUST_STD_COMPLEX_IMAG(z) \ + reinterpret_cast< \ + const typename thrust::detail::remove_reference::type::value_type (&)[2] \ + >(z)[1] +#define THRUST_STD_COMPLEX_DEVICE __device__ namespace thrust { @@ -65,75 +59,12 @@ namespace thrust namespace detail { - + template -struct complex_storage; - -#if THRUST_CPP_DIALECT >= 2011 \ - && (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) \ - && (THRUST_GCC_VERSION >= 40800) - // C++11 implementation, excluding GCC 4.7, which doesn't have `alignas`. - template - struct complex_storage - { - struct alignas(Align) type { T x; T y; }; - }; -#elif (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) \ - || ( (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) \ - && (THRUST_GCC_VERSION < 40600)) - // C++03 implementation for MSVC and GCC <= 4.5. - // - // We have to implement `aligned_type` with specializations for MSVC - // and GCC 4.2 and older because they require literals as arguments to - // their alignment attribute. - - #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) - // MSVC implementation. - #define THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(X) \ - template \ - struct complex_storage \ - { \ - __declspec(align(X)) struct type { T x; T y; }; \ - }; \ - /**/ - #else - // GCC <= 4.2 implementation. - #define THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(X) \ - template \ - struct complex_storage \ - { \ - struct type { T x; T y; } __attribute__((aligned(X))); \ - }; \ - /**/ - #endif - - // The primary template is a fallback, which doesn't specify any alignment. - // It's only used when T is very large and we're using an older compilers - // which we have to fully specialize each alignment case. - template - struct complex_storage - { - T x; T y; - }; - - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(1); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(2); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(4); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(8); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(16); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(32); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(64); - THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION(128); - - #undef THRUST_DEFINE_COMPLEX_STORAGE_SPECIALIZATION -#else - // C++03 implementation for GCC > 4.5, Clang, PGI, ICPC, and xlC. - template - struct complex_storage - { - struct type { T x; T y; } __attribute__((aligned(Align))); - }; -#endif +struct complex_storage +{ + struct alignas(Align) type { T x; T y; }; +}; } // end namespace detail @@ -173,7 +104,6 @@ struct complex __host__ __device__ complex(const T& re, const T& im); -#if THRUST_CPP_DIALECT >= 2011 /*! Default construct a complex number. */ complex() = default; @@ -184,20 +114,6 @@ struct complex * \param z The \p complex to copy from. */ complex(const complex& z) = default; -#else - /*! Default construct a complex number. - */ - __host__ __device__ - complex(); - - /*! This copy constructor copies from a \p complex with a type that is - * convertible to this \p complex's \c value_type. - * - * \param z The \p complex to copy from. - */ - __host__ __device__ - complex(const complex& z); -#endif /*! This converting copy constructor copies from a \p complex with a type * that is convertible to this \p complex's \c value_type. @@ -241,22 +157,12 @@ struct complex __host__ __device__ complex& operator=(const T& re); -#if THRUST_CPP_DIALECT >= 2011 /*! Assign `z.real()` and `z.imag()` to the real and imaginary parts of this * \p complex respectively. * * \param z The \p complex to copy from. */ complex& operator=(const complex& z) = default; -#else - /*! Assign `z.real()` and `z.imag()` to the real and imaginary parts of this - * \p complex respectively. - * - * \param z The \p complex to copy from. - */ - __host__ __device__ - complex& operator=(const complex& z); -#endif /*! Assign `z.real()` and `z.imag()` to the real and imaginary parts of this * \p complex respectively. diff --git a/thrust/detail/alignment.h b/thrust/detail/alignment.h index 89c8afcd8..05f5862bf 100644 --- a/thrust/detail/alignment.h +++ b/thrust/detail/alignment.h @@ -25,9 +25,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`. -#endif +#include // For `std::alignment_of` and `std::aligned_storage`. namespace thrust { @@ -36,175 +34,48 @@ namespace detail /// \p THRUST_ALIGNOF is a macro that takes a single type-id as a parameter, /// and returns the alignment requirement of the type in bytes. -/// +/// /// It is an approximation of C++11's `alignof` operator. /// /// Note: MSVC does not allow the builtin used to implement this to be placed /// inside of a `__declspec(align(#))` attribute. As a workaround, you can /// assign the result of \p THRUST_ALIGNOF to a variable and pass the variable /// as the argument to `__declspec(align(#))`. -#if THRUST_CPP_DIALECT >= 2011 - #define THRUST_ALIGNOF(x) alignof(x) -#else - #define THRUST_ALIGNOF(x) __alignof(x) -#endif +#define THRUST_ALIGNOF(x) alignof(x) /// \p alignment_of provides the member constant `value` which is equal to the /// alignment requirement of the type `T`, as if obtained by a C++11 `alignof` /// expression. -/// +/// /// It is an implementation of C++11's \p std::alignment_of. -#if THRUST_CPP_DIALECT >= 2011 - template - using alignment_of = std::alignment_of; -#else - template - struct alignment_of; - - template - struct alignment_of_helper - { - static const std::size_t value = - integral_constant::value; - }; - - template - struct alignment_of_helper - { - static const std::size_t value = alignment_of::value; - }; - - template - struct alignment_of - { - private: - struct impl - { - T x; - char c; - }; - - public: - static const std::size_t value = - alignment_of_helper::value; - }; -#endif +template +using alignment_of = std::alignment_of; /// \p aligned_type provides the nested type `type`, which is a trivial /// type whose alignment requirement is a divisor of `Align`. /// /// The behavior is undefined if `Align` is not a power of 2. template -struct aligned_type; - -#if THRUST_CPP_DIALECT >= 2011 \ - && (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) \ - && (THRUST_GCC_VERSION >= 40800) - // C++11 implementation, excluding GCC 4.7, which doesn't have `alignas`. - template - struct aligned_type - { - struct alignas(Align) type {}; - }; -#elif (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) \ - || ( (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) \ - && (THRUST_GCC_VERSION < 40600)) - // C++03 implementation for MSVC and GCC <= 4.5. - // - // We have to implement `aligned_type` with specializations for MSVC - // and GCC 4.2.x and older because they require literals as arguments to - // their alignment attribute. - - #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) - // MSVC implementation. - #define THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(X) \ - template <> \ - struct aligned_type \ - { \ - __declspec(align(X)) struct type {}; \ - }; \ - /**/ - #else - // GCC <= 4.2 implementation. - #define THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(X) \ - template <> \ - struct aligned_type \ - { \ - struct type {} __attribute__((aligned(X))); \ - }; \ - /**/ - #endif - - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(1); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(2); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(4); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(8); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(16); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(32); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(64); - THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION(128); - - #undef THRUST_DEFINE_ALIGNED_TYPE_SPECIALIZATION -#else - // C++03 implementation for GCC > 4.5, Clang, PGI, ICPC, and xlC. - template - struct aligned_type - { - struct type {} __attribute__((aligned(Align))); - }; -#endif +struct aligned_type +{ + struct alignas(Align) type {}; +}; /// \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 +template +using aligned_storage = std::aligned_storage; /// \p max_align_t is a trivial type whose alignment requirement is at least as /// strict (as large) as that of every scalar type. /// /// It is an implementation of C++11's \p std::max_align_t. -#if THRUST_CPP_DIALECT >= 2011 \ - && (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) \ - && (THRUST_GCC_VERSION >= 40900) - // GCC 4.7 and 4.8 don't have `std::max_align_t`. - using max_align_t = std::max_align_t; -#else - union max_align_t - { - // These cannot be private because C++03 POD types cannot have private - // data members. - char c; - short s; - int i; - long l; - float f; - double d; - long long ll; - long double ld; - void* p; - }; -#endif +using max_align_t = std::max_align_t; /// \p aligned_reinterpret_cast `reinterpret_cast`s \p u of type \p U to `void*` /// and then `reinterpret_cast`s the result to \p T. The indirection through diff --git a/thrust/detail/allocator/allocator_traits.h b/thrust/detail/allocator/allocator_traits.h index 768f74dab..087c820f6 100644 --- a/thrust/detail/allocator/allocator_traits.h +++ b/thrust/detail/allocator/allocator_traits.h @@ -164,7 +164,6 @@ template::value> typedef typename Alloc::template rebind::other type; }; -#if THRUST_CPP_DIALECT >= 2011 template class Alloc, typename T, typename... Args, typename U> struct rebind_alloc, U, true> @@ -178,61 +177,6 @@ template class Alloc, { typedef Alloc type; }; -#else // C++03 -template