diff --git a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp index 3645e1b338..dda236a3e5 100644 --- a/benchmarks/dbscan/ArborX_DBSCANVerification.hpp +++ b/benchmarks/dbscan/ArborX_DBSCANVerification.hpp @@ -254,12 +254,12 @@ bool verifyClustersAreUnique(ExecutionSpace const &exec_space, } if (cluster_sets.size() != num_unique_cluster_indices) { - std::cerr << "Number of components does not match" << std::endl; + std::cerr << "Number of components does not match" << '\n'; return false; } if (num_clusters != num_unique_cluster_indices) { - std::cerr << "Cluster IDs are not unique" << std::endl; + std::cerr << "Cluster IDs are not unique" << '\n'; return false; } @@ -306,7 +306,7 @@ bool verifyDBSCAN(ExecutionSpace exec_space, Primitives const &primitives, ARBORX_ASSERT(eps > 0); ARBORX_ASSERT(core_min_size >= 2); - Points points{primitives}; + Points const &points{primitives}; using Point = typename Points::value_type; static_assert(GeometryTraits::is_point{}); diff --git a/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp b/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp index 2edfcdde80..7aa9e7e29a 100644 --- a/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp +++ b/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp @@ -219,7 +219,7 @@ struct ArborX::AccessTraits, namespace bpo = boost::program_options; template -int main_(std::vector const &args, const MPI_Comm comm) +int main_(std::vector const &args, MPI_Comm const comm) { TimeMonitor time_monitor; diff --git a/examples/raytracing/example_raytracing.cpp b/examples/raytracing/example_raytracing.cpp index 6f1671c263..f2ff595ede 100644 --- a/examples/raytracing/example_raytracing.cpp +++ b/examples/raytracing/example_raytracing.cpp @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) "Example::initialize_rays", Kokkos::MDRangePolicy, ExecutionSpace>( exec_space, {0, 0}, {num_boxes, rays_per_box}), - KOKKOS_LAMBDA(const size_t i, const size_t j) { + KOKKOS_LAMBDA(size_t const i, size_t const j) { // The origins of rays are uniformly distributed in the boxes. The // direction vectors are uniformly sampling of a full sphere. GeneratorType g = rand_pool.get_state(); diff --git a/examples/triangle_intersection/triangle_intersection.cpp b/examples/triangle_intersection/triangle_intersection.cpp index 30b7fdba1c..e196d5e9a5 100644 --- a/examples/triangle_intersection/triangle_intersection.cpp +++ b/examples/triangle_intersection/triangle_intersection.cpp @@ -368,6 +368,6 @@ int main() } }, Kokkos::LAnd(success)); - std::cout << "Check " << (success ? "succeeded" : "failed") << std::endl; + std::cout << "Check " << (success ? "succeeded" : "failed") << '\n'; return success ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/ArborX_BruteForce.hpp b/src/ArborX_BruteForce.hpp index dfbd98a3b4..e01af06d4e 100644 --- a/src/ArborX_BruteForce.hpp +++ b/src/ArborX_BruteForce.hpp @@ -192,7 +192,7 @@ BruteForce::BruteForce( PrimitivesTag{}, user_values, Details::DoNotCheckGetReturnType()); using Values = Details::AccessValues; - Values values{user_values}; + Values const &values{user_values}; static_assert( Details::KokkosExt::is_accessible_from::query( ExecutionSpace>::value, "Predicates must be accessible from the execution space"); - Predicates predicates{user_predicates}; + Predicates const &predicates{user_predicates}; using Tag = typename Predicates::value_type::Tag; static_assert(std::is_same{}, diff --git a/src/ArborX_DBSCAN.hpp b/src/ArborX_DBSCAN.hpp index edf90a9c89..5ab0052620 100644 --- a/src/ArborX_DBSCAN.hpp +++ b/src/ArborX_DBSCAN.hpp @@ -271,7 +271,7 @@ dbscan(ExecutionSpace const &exec_space, Primitives const &primitives, bool const verbose = parameters._verbose; - Points points{primitives}; + Points const &points{primitives}; int const n = points.size(); Kokkos::View num_neigh("ArborX::DBSCAN::num_neighbors", diff --git a/src/ArborX_DistributedTree.hpp b/src/ArborX_DistributedTree.hpp index 6601e062c6..e2d17da5f0 100644 --- a/src/ArborX_DistributedTree.hpp +++ b/src/ArborX_DistributedTree.hpp @@ -50,7 +50,6 @@ class DistributedTreeBase using bounding_volume_type = BoundingVolume; using value_type = typename BottomTree::value_type; -public: template DistributedTreeBase(MPI_Comm comm, ExecutionSpace const &space, Args &&...args); @@ -93,7 +92,7 @@ class DistributedTreeBase typename Predicates::memory_space, ExecutionSpace>::value, "Predicates must be accessible from the execution space"); - Predicates predicates{user_predicates}; + Predicates const &predicates{user_predicates}; using Tag = typename Predicates::value_type::Tag; Details::DistributedTreeImpl::queryDispatch(Tag{}, *this, space, predicates, @@ -182,7 +181,7 @@ class DistributedTree::value, "Predicates must be accessible from the execution space"); - Predicates predicates{user_predicates}; + Predicates const &predicates{user_predicates}; using Tag = typename Predicates::value_type::Tag; if constexpr (std::is_same_v) diff --git a/src/ArborX_LinearBVH.hpp b/src/ArborX_LinearBVH.hpp index ea2a3c4bd0..04685cd2d4 100644 --- a/src/ArborX_LinearBVH.hpp +++ b/src/ArborX_LinearBVH.hpp @@ -268,7 +268,7 @@ BoundingVolumeHierarchy:: PrimitivesTag{}, user_values, Details::DoNotCheckGetReturnType()); using Values = Details::AccessValues; - Values values{user_values}; + Values const &values{user_values}; static_assert( Details::KokkosExt::is_accessible_from::value, "Predicates must be accessible from the execution space"); - Predicates predicates{user_predicates}; + Predicates const &predicates{user_predicates}; using Tag = typename Predicates::value_type::Tag; std::string profiling_prefix = "ArborX::BVH::query::"; diff --git a/src/details/ArborX_AccessTraits.hpp b/src/details/ArborX_AccessTraits.hpp index bd4126dbd3..4edf5e1139 100644 --- a/src/details/ArborX_AccessTraits.hpp +++ b/src/details/ArborX_AccessTraits.hpp @@ -268,7 +268,7 @@ struct AccessTraits< : Traits::Access { template - static constexpr bool always_false = std::is_void::value; + static constexpr bool always_false = std::is_void_v; static_assert( always_false, "ArborX::Traits::Access was removed. Use ArborX::AccessTraits instead"); diff --git a/src/details/ArborX_DetailsDistributedTreeUtils.hpp b/src/details/ArborX_DetailsDistributedTreeUtils.hpp index 352c6822ec..69586dd544 100644 --- a/src/details/ArborX_DetailsDistributedTreeUtils.hpp +++ b/src/details/ArborX_DetailsDistributedTreeUtils.hpp @@ -30,7 +30,7 @@ namespace ArborX::Details::DistributedTree { template -typename std::enable_if::value>::type +std::enable_if_t::value> sendAcrossNetwork(ExecutionSpace const &space, Distributor const &distributor, View exports, typename View::non_const_type imports) { diff --git a/src/details/ArborX_DetailsDistributor.hpp b/src/details/ArborX_DetailsDistributor.hpp index 70b0084f4e..35e08b7ebf 100644 --- a/src/details/ArborX_DetailsDistributor.hpp +++ b/src/details/ArborX_DetailsDistributor.hpp @@ -46,9 +46,8 @@ determineBufferLayout(ExecutionSpace const &space, InputView batched_ranks, ARBORX_ASSERT(counts.empty()); ARBORX_ASSERT(permutation_indices.extent_int(0) == 0); ARBORX_ASSERT(batched_ranks.size() + 1 == batched_offsets.size()); - static_assert( - std::is_same::value); - static_assert(std::is_same::value); + static_assert(std::is_same_v); + static_assert(std::is_same_v); // In case all the batches are empty, return an empty list of unique_ranks and // counts, but still have one element in offsets. This is conforming with @@ -143,9 +142,8 @@ static void sortAndDetermineBufferLayout(ExecutionSpace const &space, ARBORX_ASSERT(offsets.empty()); ARBORX_ASSERT(counts.empty()); ARBORX_ASSERT(permutation_indices.extent_int(0) == ranks.extent_int(0)); - static_assert( - std::is_same::value); - static_assert(std::is_same::value); + static_assert(std::is_same_v); + static_assert(std::is_same_v); offsets.push_back(0); diff --git a/src/details/ArborX_DetailsPriorityQueue.hpp b/src/details/ArborX_DetailsPriorityQueue.hpp index e689a62d84..76e5085b05 100644 --- a/src/details/ArborX_DetailsPriorityQueue.hpp +++ b/src/details/ArborX_DetailsPriorityQueue.hpp @@ -37,7 +37,7 @@ class PriorityQueue using size_type = typename Container::size_type; using reference = typename Container::reference; using const_reference = typename Container::const_reference; - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Template parameter T in PriorityQueue is not the same as " "the type of the elements stored by the underlying " "container Container::value_type"); diff --git a/src/details/ArborX_DetailsSortUtils.hpp b/src/details/ArborX_DetailsSortUtils.hpp index b4ebed167b..092417d330 100644 --- a/src/details/ArborX_DetailsSortUtils.hpp +++ b/src/details/ArborX_DetailsSortUtils.hpp @@ -92,7 +92,7 @@ void applyInversePermutation(ExecutionSpace const &space, InputView const &input_view, OutputView const &output_view) { - static_assert(std::is_integral::value); + static_assert(std::is_integral_v); ARBORX_ASSERT(permutation.extent(0) == input_view.extent(0)); ARBORX_ASSERT(output_view.extent(0) == input_view.extent(0)); @@ -112,7 +112,7 @@ void applyPermutation(ExecutionSpace const &space, InputView const &input_view, OutputView const &output_view) { - static_assert(std::is_integral::value); + static_assert(std::is_integral_v); ARBORX_ASSERT(permutation.extent(0) == input_view.extent(0)); ARBORX_ASSERT(output_view.extent(0) == input_view.extent(0)); @@ -129,7 +129,7 @@ template void applyPermutation(ExecutionSpace const &space, PermutationView const &permutation, View &view) { - static_assert(std::is_integral::value); + static_assert(std::is_integral_v); auto scratch_view = KokkosExt::clone(space, view); applyPermutation(space, permutation, scratch_view, view); } diff --git a/src/details/ArborX_DetailsStack.hpp b/src/details/ArborX_DetailsStack.hpp index beb01b574b..d7475c9a67 100644 --- a/src/details/ArborX_DetailsStack.hpp +++ b/src/details/ArborX_DetailsStack.hpp @@ -32,7 +32,7 @@ class Stack using size_type = typename Container::size_type; using reference = typename Container::reference; using const_reference = typename Container::const_reference; - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Template parameter T in Stack is not the same as " "the type of the elements stored by the underlying " "container Container::value_type"); diff --git a/src/details/ArborX_DetailsTreeConstruction.hpp b/src/details/ArborX_DetailsTreeConstruction.hpp index 313715c6de..b733c31291 100644 --- a/src/details/ArborX_DetailsTreeConstruction.hpp +++ b/src/details/ArborX_DetailsTreeConstruction.hpp @@ -45,8 +45,8 @@ inline void projectOntoSpaceFillingCurve(ExecutionSpace const &space, size_t const n = indexables.size(); ARBORX_ASSERT(linear_ordering_indices.extent(0) == n); static_assert( - std::is_same::value); + std::is_same_v); Kokkos::parallel_for( "ArborX::TreeConstruction::project_primitives_onto_space_filling_curve", diff --git a/src/details/ArborX_DetailsUtils.hpp b/src/details/ArborX_DetailsUtils.hpp index ba3d25d240..94e19a406d 100644 --- a/src/details/ArborX_DetailsUtils.hpp +++ b/src/details/ArborX_DetailsUtils.hpp @@ -334,7 +334,7 @@ reallocWithoutInitializing(View &v, size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, template [[deprecated]] void -reallocWithoutInitializing(View &v, const typename View::array_layout &layout) +reallocWithoutInitializing(View &v, typename View::array_layout const &layout) { using ExecutionSpace = typename View::execution_space; Details::KokkosExt::reallocWithoutInitializing(ExecutionSpace{}, v, layout); diff --git a/src/details/ArborX_MinimumSpanningTree.hpp b/src/details/ArborX_MinimumSpanningTree.hpp index 94c052a07d..f2adda9b18 100644 --- a/src/details/ArborX_MinimumSpanningTree.hpp +++ b/src/details/ArborX_MinimumSpanningTree.hpp @@ -52,7 +52,7 @@ struct MinimumSpanningTree using Point = typename Points::value_type; static_assert(GeometryTraits::is_point{}); - Points points{primitives}; + Points const &points{primitives}; auto const n = points.size(); diff --git a/src/details/ArborX_NeighborList.hpp b/src/details/ArborX_NeighborList.hpp index 29b9a24769..392a9cc60e 100644 --- a/src/details/ArborX_NeighborList.hpp +++ b/src/details/ArborX_NeighborList.hpp @@ -63,7 +63,7 @@ void findHalfNeighborList(ExecutionSpace const &space, using Point = typename Points::value_type; static_assert(GeometryTraits::is_point{}); - Points points{primitives}; + Points const &points{primitives}; int const n = points.size(); BoundingVolumeHierarchy> bvh( @@ -119,7 +119,7 @@ void findFullNeighborList(ExecutionSpace const &space, using Point = typename Points::value_type; static_assert(GeometryTraits::is_point{}); - Points points{primitives}; + Points const &points{primitives}; int const n = points.size(); BoundingVolumeHierarchy> bvh( diff --git a/src/details/ArborX_SpaceFillingCurves.hpp b/src/details/ArborX_SpaceFillingCurves.hpp index bc27ded2ee..c9d7544b30 100644 --- a/src/details/ArborX_SpaceFillingCurves.hpp +++ b/src/details/ArborX_SpaceFillingCurves.hpp @@ -87,8 +87,8 @@ void check_valid_space_filling_curve(SpaceFillingCurve const &) using OrderValueType = std::invoke_result_t; - static_assert(std::is_same::value || - std::is_same::value); + static_assert(std::is_same_v || + std::is_same_v); static_assert(std::is_same_v< OrderValueType, std::invoke_result_t>); diff --git a/src/geometry/ArborX_GeometryTraits.hpp b/src/geometry/ArborX_GeometryTraits.hpp index 7c13b9bb78..270225f68e 100644 --- a/src/geometry/ArborX_GeometryTraits.hpp +++ b/src/geometry/ArborX_GeometryTraits.hpp @@ -111,9 +111,8 @@ void check_valid_geometry_traits(Geometry const &) GeometryTraits::dimension_v > 0, "GeometryTraits::dimension::value must be a positive integral"); - static_assert( - !std::is_same::type, not_specialized>::value, - "GeometryTraits::tag must define 'type' member type"); + static_assert(!std::is_same_v::type, not_specialized>, + "GeometryTraits::tag must define 'type' member type"); using Tag = typename tag::type; static_assert(std::is_same{} || std::is_same{} || std::is_same{} || @@ -122,8 +121,8 @@ void check_valid_geometry_traits(Geometry const &) "GeometryTraits::tag::type must be PointTag, BoxTag, " "SphereTag, TriangleTag or KDOPTag"); - static_assert(!std::is_same::type, - not_specialized>::value, + static_assert(!std::is_same_v::type, + not_specialized>, "GeometryTraits::coordinate_type must define 'type' " "member type"); using Coordinate = typename coordinate_type::type; diff --git a/src/interpolation/ArborX_InterpMovingLeastSquares.hpp b/src/interpolation/ArborX_InterpMovingLeastSquares.hpp index 76621d0f76..c8ea8eae69 100644 --- a/src/interpolation/ArborX_InterpMovingLeastSquares.hpp +++ b/src/interpolation/ArborX_InterpMovingLeastSquares.hpp @@ -145,8 +145,8 @@ class MovingLeastSquares : Details::polynomialBasisSize(); - TargetAccess target_access{target_points}; - SourceAccess source_access{source_points}; + TargetAccess const &target_access{target_points}; + SourceAccess const &source_access{source_points}; _num_targets = target_access.size(); _source_size = source_access.size(); diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtStdAlgorithms.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtStdAlgorithms.hpp index 9d7fc45fc4..e3da1c8ea4 100644 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtStdAlgorithms.hpp +++ b/src/kokkos_ext/ArborX_DetailsKokkosExtStdAlgorithms.hpp @@ -35,8 +35,8 @@ void exclusive_scan(ExecutionSpace const &space, SrcView const &src, is_accessible_from::value, "Destination view must be accessible from the execution " "space"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "exclusive_scan requires non-const destination type"); static_assert(unsigned(DstView::rank) == unsigned(SrcView::rank) && unsigned(DstView::rank) == unsigned(1), @@ -103,11 +103,11 @@ void adjacent_difference(ExecutionSpace const &space, SrcView const &src, static_assert(SrcView::rank == 1 && DstView::rank == 1, "adjacent_difference operates on rank-1 views"); static_assert( - std::is_same::value, + std::is_same_v, "adjacent_difference requires non-const destination value type"); - static_assert(std::is_same::value, + static_assert(std::is_same_v, "adjacent_difference requires same value type for source and " "destination"); @@ -137,10 +137,10 @@ void iota(ExecutionSpace const &space, ViewType const &v, "iota requires a View of rank 1"); using ValueType = typename ViewType::value_type; - static_assert(std::is_arithmetic::value, + static_assert(std::is_arithmetic_v, "iota requires a View with an arithmetic value type"); static_assert( - std::is_same::value, + std::is_same_v, "iota requires a View with non-const value type"); Kokkos::parallel_for( diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtSwap.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtSwap.hpp index 648a0a4768..768fafb8fe 100644 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtSwap.hpp +++ b/src/kokkos_ext/ArborX_DetailsKokkosExtSwap.hpp @@ -22,8 +22,8 @@ namespace ArborX::Details::KokkosExt template KOKKOS_FUNCTION constexpr void -swap(T &a, T &b) noexcept(std::is_nothrow_move_constructible::value - &&std::is_nothrow_move_assignable::value) +swap(T &a, T &b) noexcept(std::is_nothrow_move_constructible_v && + std::is_nothrow_move_assignable_v) { T tmp = std::move(a); a = std::move(b); diff --git a/src/kokkos_ext/ArborX_DetailsKokkosExtViewHelpers.hpp b/src/kokkos_ext/ArborX_DetailsKokkosExtViewHelpers.hpp index 765f19f9bb..5f6026f710 100644 --- a/src/kokkos_ext/ArborX_DetailsKokkosExtViewHelpers.hpp +++ b/src/kokkos_ext/ArborX_DetailsKokkosExtViewHelpers.hpp @@ -61,7 +61,7 @@ void reallocWithoutInitializing(ExecutionSpace const &space, View &v, template void reallocWithoutInitializing(ExecutionSpace const &space, View &v, - const typename View::array_layout &layout) + typename View::array_layout const &layout) { static_assert(Kokkos::is_execution_space::value); Kokkos::realloc(Kokkos::view_alloc(space, Kokkos::WithoutInitializing), v, diff --git a/test/ArborX_BoostRangeAdapters.hpp b/test/ArborX_BoostRangeAdapters.hpp index 0c8083155c..9527601e9b 100644 --- a/test/ArborX_BoostRangeAdapters.hpp +++ b/test/ArborX_BoostRangeAdapters.hpp @@ -38,8 +38,8 @@ struct range_iterator> { using View = Kokkos::View; ARBORX_ASSERT_VIEW_COMPATIBLE(View) - using type = typename std::add_pointer< - typename Kokkos::ViewTraits::value_type>::type; + using type = + std::add_pointer_t::value_type>; }; template @@ -47,8 +47,8 @@ struct range_const_iterator> { using View = Kokkos::View; ARBORX_ASSERT_VIEW_COMPATIBLE(View) - using type = typename std::add_pointer< - typename Kokkos::ViewTraits::const_value_type>::type; + using type = std::add_pointer_t< + typename Kokkos::ViewTraits::const_value_type>; }; template diff --git a/test/ArborX_EnableViewComparison.hpp b/test/ArborX_EnableViewComparison.hpp index b66800da05..5436ece617 100644 --- a/test/ArborX_EnableViewComparison.hpp +++ b/test/ArborX_EnableViewComparison.hpp @@ -114,12 +114,13 @@ struct is_forward_iterable> : public boost::mpl::true_ { // NOTE Prefer static assertion to SFINAE because error message about no // operator== for the operands is not as clear. - static_assert(Kokkos::View::rank == 1 && - !std::is_same::array_layout, - Kokkos::LayoutStride>::value && - ArborX::Details::KokkosExt::is_accessible_from_host< - Kokkos::View>::value, - "Restricted to contiguous rank-one host-accessible views"); + static_assert( + Kokkos::View::rank == 1 && + !std::is_same_v::array_layout, + Kokkos::LayoutStride> && + ArborX::Details::KokkosExt::is_accessible_from_host< + Kokkos::View>::value, + "Restricted to contiguous rank-one host-accessible views"); }; template @@ -128,7 +129,7 @@ struct bt_iterator_traits, true> using view_type = Kokkos::View; using value_type = typename view_type::value_type; using const_iterator = - typename std::add_pointer::type; + std::add_pointer_t; static const_iterator begin(view_type const &v) { return v.data(); } static const_iterator end(view_type const &v) { return v.data() + v.size(); } static std::size_t size(view_type const &v) { return v.size(); } diff --git a/test/tstMinimumSpanningTreeGoldenTest.cpp b/test/tstMinimumSpanningTreeGoldenTest.cpp index 280eef583d..b9101b1c58 100644 --- a/test/tstMinimumSpanningTreeGoldenTest.cpp +++ b/test/tstMinimumSpanningTreeGoldenTest.cpp @@ -52,8 +52,8 @@ auto parsePointsFromCSVFile(std::string const &filename) Tokenizer tok(line); auto first = tok.begin(); auto const last = tok.end(); - points.emplace_back(ArborX::Point{std::stof(*first++), std::stof(*first++), - std::stof(*first++)}); + points.emplace_back(std::stof(*first++), std::stof(*first++), + std::stof(*first++)); assert(first == last); } return points; diff --git a/test/tstSequenceContainers.cpp b/test/tstSequenceContainers.cpp index a7e7cf91ed..886d68d983 100644 --- a/test/tstSequenceContainers.cpp +++ b/test/tstSequenceContainers.cpp @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(non_owning_view_over_dynamic_array) // ^^^^ ^^^^ ^^^^ UnmanagedStaticVector a(data + 2, 3); - BOOST_TEST(!std::is_default_constructible::value); + BOOST_TEST(!std::is_default_constructible_v); BOOST_TEST(a.data() == data + 2); BOOST_TEST(a.empty());