From 4c9ef5161268e2486938546deef00f7fc84c9a95 Mon Sep 17 00:00:00 2001 From: Karthikeyan <6488848+karthikeyann@users.noreply.github.com> Date: Sat, 26 Feb 2022 19:18:41 +0530 Subject: [PATCH] C++17 cleanup: traits replace std::enable_if<>::type with std::enable_if_t (#10343) Authors: - Karthikeyan (https://github.com/karthikeyann) Approvers: - Bradley Dice (https://github.com/bdice) - David Wendt (https://github.com/davidwendt) - Robert Maynard (https://github.com/robertmaynard) - Nghia Truong (https://github.com/ttnghia) URL: https://github.com/rapidsai/cudf/pull/10343 --- cpp/benchmarks/common/generate_input.cpp | 12 +- cpp/benchmarks/common/generate_input.hpp | 27 ++-- .../common/random_distribution_factory.hpp | 8 +- cpp/benchmarks/string/json.cu | 1 - .../type_dispatcher/type_dispatcher.cu | 2 +- .../detail/calendrical_month_sequence.cuh | 18 +-- cpp/include/cudf/detail/reduction.cuh | 10 +- .../cudf/detail/utilities/device_atomics.cuh | 12 +- .../detail/utilities/device_operators.cuh | 53 ++++---- cpp/include/cudf/utilities/span.hpp | 18 +-- cpp/include/cudf/utilities/traits.hpp | 8 +- cpp/include/cudf_test/column_utilities.hpp | 6 +- cpp/include/cudf_test/column_wrapper.hpp | 36 ++--- cpp/include/cudf_test/type_lists.hpp | 11 +- cpp/src/binaryop/compiled/binary_ops.cu | 18 +-- cpp/src/column/column_factories.cpp | 9 +- cpp/src/datetime/datetime_ops.cu | 20 +-- cpp/src/dictionary/detail/concatenate.cu | 6 +- cpp/src/dictionary/set_keys.cu | 6 +- cpp/src/filling/sequence.cu | 12 +- cpp/src/groupby/sort/group_nunique.cu | 22 ++-- cpp/src/groupby/sort/group_tdigest.cu | 14 +- cpp/src/io/csv/csv_gpu.cu | 16 +-- cpp/src/io/json/json_gpu.cu | 9 +- cpp/src/io/orc/orc.h | 52 ++++---- cpp/src/io/utilities/parsing_utils.cuh | 4 +- cpp/src/reductions/scan/scan_exclusive.cu | 2 +- cpp/src/reductions/scan/scan_inclusive.cu | 4 +- cpp/src/reductions/simple.cuh | 21 ++- cpp/src/replace/nulls.cu | 5 +- cpp/src/reshape/interleave_columns.cu | 10 +- cpp/src/rolling/rolling_detail.cuh | 14 +- cpp/src/round/round.cu | 36 ++--- cpp/src/scalar/scalar_factories.cpp | 18 ++- cpp/src/sort/sort.cu | 6 +- cpp/src/sort/sort_column.cu | 12 +- cpp/src/sort/stable_sort_column.cu | 12 +- cpp/src/unary/cast_ops.cu | 123 +++++++++--------- cpp/src/unary/math_ops.cu | 26 ++-- cpp/tests/binaryop/binop-fixture.hpp | 6 +- cpp/tests/binaryop/util/operation.h | 79 ++++++----- cpp/tests/copying/copy_tests.cpp | 10 +- .../device_atomics/device_atomics_test.cu | 8 +- cpp/tests/groupby/tdigest_tests.cu | 12 +- cpp/tests/io/csv_test.cpp | 4 +- cpp/tests/quantiles/percentile_approx_test.cu | 35 +++-- cpp/tests/reductions/reduction_tests.cpp | 4 +- cpp/tests/reductions/scan_tests.hpp | 14 +- cpp/tests/sort/is_sorted_tests.cpp | 27 ++-- cpp/tests/utilities/column_utilities.cu | 21 ++- cpp/tests/wrappers/timestamps_test.cu | 6 +- 51 files changed, 437 insertions(+), 488 deletions(-) diff --git a/cpp/benchmarks/common/generate_input.cpp b/cpp/benchmarks/common/generate_input.cpp index d6564428a2e0..6330beda54ca 100644 --- a/cpp/benchmarks/common/generate_input.cpp +++ b/cpp/benchmarks/common/generate_input.cpp @@ -122,7 +122,7 @@ struct random_value_fn; * @brief Creates an random timestamp/duration value */ template -struct random_value_fn()>> { +struct random_value_fn()>> { std::function seconds_gen; std::function nanoseconds_gen; @@ -164,7 +164,7 @@ struct random_value_fn()>> { * @brief Creates an random fixed_point value. Not implemented yet. */ template -struct random_value_fn()>> { +struct random_value_fn()>> { using rep = typename T::rep; rep const lower_bound; rep const upper_bound; @@ -194,9 +194,7 @@ struct random_value_fn()>> * @brief Creates an random numeric value with the given distribution. */ template -struct random_value_fn< - T, - typename std::enable_if_t && cudf::is_numeric()>> { +struct random_value_fn && cudf::is_numeric()>> { T const lower_bound; T const upper_bound; distribution_fn dist; @@ -219,7 +217,7 @@ struct random_value_fn< * @brief Creates an boolean value with given probability of returning `true`. */ template -struct random_value_fn>> { +struct random_value_fn>> { std::bernoulli_distribution b_dist; random_value_fn(distribution_params const& desc) : b_dist{desc.probability_true} {} @@ -260,7 +258,7 @@ struct stored_as { // Use `int8_t` for bools because that's how they're stored in columns template -struct stored_as>> { +struct stored_as>> { using type = int8_t; }; diff --git a/cpp/benchmarks/common/generate_input.hpp b/cpp/benchmarks/common/generate_input.hpp index 17bd650e7220..43fee5c50a75 100644 --- a/cpp/benchmarks/common/generate_input.hpp +++ b/cpp/benchmarks/common/generate_input.hpp @@ -128,9 +128,7 @@ struct distribution_params; * @brief Numeric values are parameterized with a distribution type and bounds of the same type. */ template -struct distribution_params< - T, - typename std::enable_if_t && cudf::is_numeric()>> { +struct distribution_params && cudf::is_numeric()>> { distribution_id id; T lower_bound; T upper_bound; @@ -140,7 +138,7 @@ struct distribution_params< * @brief Booleans are parameterized with the probability of getting `true` value. */ template -struct distribution_params>> { +struct distribution_params>> { double probability_true; }; @@ -148,7 +146,7 @@ struct distribution_params> * @brief Timestamps and durations are parameterized with a distribution type and int64_t bounds. */ template -struct distribution_params()>> { +struct distribution_params()>> { distribution_id id; int64_t lower_bound; int64_t upper_bound; @@ -158,7 +156,7 @@ struct distribution_params()>> { * @brief Strings are parameterized by the distribution of their length, as an integral value. */ template -struct distribution_params>> { +struct distribution_params>> { distribution_params length_params; }; @@ -167,7 +165,7 @@ struct distribution_params -struct distribution_params>> { +struct distribution_params>> { cudf::type_id element_type; distribution_params length_params; cudf::size_type max_depth; @@ -175,7 +173,7 @@ struct distribution_params -struct distribution_params()>> { +struct distribution_params()>> { }; /** @@ -225,8 +223,7 @@ class data_profile { public: template && cuda::std::is_integral_v, T>* = - nullptr> + std::enable_if_t && cuda::std::is_integral_v, T>* = nullptr> distribution_params get_distribution_params() const { auto it = int_params.find(cudf::type_to_id()); @@ -239,7 +236,7 @@ class data_profile { } } - template , T>* = nullptr> + template , T>* = nullptr> distribution_params get_distribution_params() const { auto it = float_params.find(cudf::type_to_id()); @@ -258,7 +255,7 @@ class data_profile { return distribution_params{bool_probability}; } - template ()>* = nullptr> + template ()>* = nullptr> distribution_params get_distribution_params() const { auto it = int_params.find(cudf::type_to_id()); @@ -284,7 +281,7 @@ class data_profile { return list_dist_desc; } - template ()>* = nullptr> + template ()>* = nullptr> distribution_params get_distribution_params() const { using rep = typename T::rep; @@ -307,7 +304,7 @@ class data_profile { // discrete distributions (integers, strings, lists). Otherwise the call with have no effect. template , T>* = nullptr> + std::enable_if_t, T>* = nullptr> void set_distribution_params(Type_enum type_or_group, distribution_id dist, T lower_bound, @@ -331,7 +328,7 @@ class data_profile { // have continuous distributions (floating point types). Otherwise the call with have no effect. template , T>* = nullptr> + std::enable_if_t, T>* = nullptr> void set_distribution_params(Type_enum type_or_group, distribution_id dist, T lower_bound, diff --git a/cpp/benchmarks/common/random_distribution_factory.hpp b/cpp/benchmarks/common/random_distribution_factory.hpp index df2b6e0a754a..f2f3833f15d1 100644 --- a/cpp/benchmarks/common/random_distribution_factory.hpp +++ b/cpp/benchmarks/common/random_distribution_factory.hpp @@ -24,7 +24,7 @@ /** * @brief Generates a normal(binomial) distribution between zero and upper_bound. */ -template , T>* = nullptr> +template , T>* = nullptr> auto make_normal_dist(T upper_bound) { using uT = typename std::make_unsigned::type; @@ -42,7 +42,7 @@ auto make_normal_dist(T upper_bound) return std::normal_distribution(mean, stddev); } -template , T>* = nullptr> +template , T>* = nullptr> auto make_uniform_dist(T range_start, T range_end) { return std::uniform_int_distribution(range_start, range_end); @@ -62,7 +62,7 @@ double geometric_dist_p(T range_size) return p ? p : std::numeric_limits::epsilon(); } -template , T>* = nullptr> +template , T>* = nullptr> auto make_geometric_dist(T range_start, T range_end) { using uT = typename std::make_unsigned::type; @@ -82,7 +82,7 @@ auto make_geometric_dist(T range_start, T range_end) template using distribution_fn = std::function; -template , T>* = nullptr> +template , T>* = nullptr> distribution_fn make_distribution(distribution_id did, T lower_bound, T upper_bound) { switch (did) { diff --git a/cpp/benchmarks/string/json.cu b/cpp/benchmarks/string/json.cu index 1a986aff83ac..69c42f97d7ff 100644 --- a/cpp/benchmarks/string/json.cu +++ b/cpp/benchmarks/string/json.cu @@ -170,7 +170,6 @@ auto build_json_string_column(int desired_bytes, int num_rows) cudf::type_id::FLOAT32, distribution_id::UNIFORM, 0.0, 1.0); auto float_2bool_columns = create_random_table({cudf::type_id::FLOAT32, cudf::type_id::BOOL8, cudf::type_id::BOOL8}, - 3, row_count{num_rows}, profile); diff --git a/cpp/benchmarks/type_dispatcher/type_dispatcher.cu b/cpp/benchmarks/type_dispatcher/type_dispatcher.cu index 48b31e5dae75..3be599e8c413 100644 --- a/cpp/benchmarks/type_dispatcher/type_dispatcher.cu +++ b/cpp/benchmarks/type_dispatcher/type_dispatcher.cu @@ -42,7 +42,7 @@ struct Functor { }; template -struct Functor>> { +struct Functor>> { static __device__ Float f(Float x) { if (ft == BANDWIDTH_BOUND) { diff --git a/cpp/include/cudf/detail/calendrical_month_sequence.cuh b/cpp/include/cudf/detail/calendrical_month_sequence.cuh index 00742db79822..321cc3d19efe 100644 --- a/cpp/include/cudf/detail/calendrical_month_sequence.cuh +++ b/cpp/include/cudf/detail/calendrical_month_sequence.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,12 +30,12 @@ namespace cudf { namespace detail { struct calendrical_month_sequence_functor { template - typename std::enable_if_t::value, std::unique_ptr> - operator()(size_type n, - scalar const& input, - size_type months, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) + std::enable_if_t::value, std::unique_ptr> operator()( + size_type n, + scalar const& input, + size_type months, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { // Return empty column if n = 0 if (n == 0) return cudf::make_empty_column(input.type()); @@ -59,8 +59,8 @@ struct calendrical_month_sequence_functor { } template - typename std::enable_if_t::value, std::unique_ptr> - operator()(Args&&...) + std::enable_if_t::value, std::unique_ptr> operator()( + Args&&...) { CUDF_FAIL("Cannot make a date_range of a non-datetime type"); } diff --git a/cpp/include/cudf/detail/reduction.cuh b/cpp/include/cudf/detail/reduction.cuh index 768252857454..e176529ed6db 100644 --- a/cpp/include/cudf/detail/reduction.cuh +++ b/cpp/include/cudf/detail/reduction.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,8 +49,8 @@ namespace detail { template ::type, - typename std::enable_if_t() && - not cudf::is_fixed_point()>* = nullptr> + std::enable_if_t() && + not cudf::is_fixed_point()>* = nullptr> std::unique_ptr reduce(InputIterator d_in, cudf::size_type num_items, op::simple_op sop, @@ -92,7 +92,7 @@ std::unique_ptr reduce(InputIterator d_in, template ::type, - typename std::enable_if_t()>* = nullptr> + std::enable_if_t()>* = nullptr> std::unique_ptr reduce(InputIterator d_in, cudf::size_type num_items, op::simple_op sop, @@ -109,7 +109,7 @@ std::unique_ptr reduce(InputIterator d_in, template ::type, - typename std::enable_if_t>* = nullptr> + std::enable_if_t>* = nullptr> std::unique_ptr reduce(InputIterator d_in, cudf::size_type num_items, op::simple_op sop, diff --git a/cpp/include/cudf/detail/utilities/device_atomics.cuh b/cpp/include/cudf/detail/utilities/device_atomics.cuh index 221e90a98167..f985135064f2 100644 --- a/cpp/include/cudf/detail/utilities/device_atomics.cuh +++ b/cpp/include/cudf/detail/utilities/device_atomics.cuh @@ -426,7 +426,7 @@ struct typesAtomicCASImpl { * @returns The old value at `address` */ template -typename std::enable_if_t(), T> __forceinline__ __device__ +std::enable_if_t(), T> __forceinline__ __device__ genericAtomicOperation(T* address, T const& update_value, BinaryOp op) { auto fun = cudf::detail::genericAtomicOperationImpl{}; @@ -435,7 +435,7 @@ genericAtomicOperation(T* address, T const& update_value, BinaryOp op) // specialization for cudf::detail::timestamp types template -typename std::enable_if_t(), T> __forceinline__ __device__ +std::enable_if_t(), T> __forceinline__ __device__ genericAtomicOperation(T* address, T const& update_value, BinaryOp op) { using R = typename T::rep; @@ -448,7 +448,7 @@ genericAtomicOperation(T* address, T const& update_value, BinaryOp op) // specialization for cudf::detail::duration types template -typename std::enable_if_t(), T> __forceinline__ __device__ +std::enable_if_t(), T> __forceinline__ __device__ genericAtomicOperation(T* address, T const& update_value, BinaryOp op) { using R = typename T::rep; @@ -616,7 +616,7 @@ __forceinline__ __device__ T atomicCAS(T* address, T compare, T val) * * @returns The old value at `address` */ -template , T>* = nullptr> +template , T>* = nullptr> __forceinline__ __device__ T atomicAnd(T* address, T val) { return cudf::genericAtomicOperation(address, val, cudf::DeviceAnd{}); @@ -637,7 +637,7 @@ __forceinline__ __device__ T atomicAnd(T* address, T val) * * @returns The old value at `address` */ -template , T>* = nullptr> +template , T>* = nullptr> __forceinline__ __device__ T atomicOr(T* address, T val) { return cudf::genericAtomicOperation(address, val, cudf::DeviceOr{}); @@ -658,7 +658,7 @@ __forceinline__ __device__ T atomicOr(T* address, T val) * * @returns The old value at `address` */ -template , T>* = nullptr> +template , T>* = nullptr> __forceinline__ __device__ T atomicXor(T* address, T val) { return cudf::genericAtomicOperation(address, val, cudf::DeviceXor{}); diff --git a/cpp/include/cudf/detail/utilities/device_operators.cuh b/cpp/include/cudf/detail/utilities/device_operators.cuh index 9423cb6b998e..87fef5bc1879 100644 --- a/cpp/include/cudf/detail/utilities/device_operators.cuh +++ b/cpp/include/cudf/detail/utilities/device_operators.cuh @@ -61,27 +61,26 @@ CUDF_HOST_DEVICE inline auto max(LHS const& lhs, RHS const& rhs) * @brief Binary `sum` operator */ struct DeviceSum { - template ()>* = nullptr> + template ()>* = nullptr> CUDF_HOST_DEVICE inline auto operator()(const T& lhs, const T& rhs) -> decltype(lhs + rhs) { return lhs + rhs; } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { return T{typename T::duration{0}}; } - template < - typename T, - typename std::enable_if_t() && !cudf::is_fixed_point()>* = nullptr> + template () && !cudf::is_fixed_point()>* = nullptr> static constexpr T identity() { return T{0}; } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { CUDF_FAIL("fixed_point does not yet support device operator identity"); @@ -93,13 +92,13 @@ struct DeviceSum { * @brief `count` operator - used in rolling windows */ struct DeviceCount { - template ()>* = nullptr> + template ()>* = nullptr> CUDF_HOST_DEVICE inline T operator()(const T& lhs, const T& rhs) { return T{DeviceCount{}(lhs.time_since_epoch(), rhs.time_since_epoch())}; } - template ()>* = nullptr> + template ()>* = nullptr> CUDF_HOST_DEVICE inline T operator()(const T&, const T& rhs) { return rhs + T{1}; @@ -123,10 +122,9 @@ struct DeviceMin { return numeric::detail::min(lhs, rhs); } - template < - typename T, - typename std::enable_if_t && !cudf::is_dictionary() && - !cudf::is_fixed_point()>* = nullptr> + template && !cudf::is_dictionary() && + !cudf::is_fixed_point()>* = nullptr> static constexpr T identity() { // chrono types do not have std::numeric_limits specializations and should use T::max() @@ -135,7 +133,7 @@ struct DeviceMin { return cuda::std::numeric_limits::max(); } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { CUDF_FAIL("fixed_point does not yet support DeviceMin identity"); @@ -143,13 +141,13 @@ struct DeviceMin { } // @brief identity specialized for string_view - template >* = nullptr> + template >* = nullptr> CUDF_HOST_DEVICE inline static constexpr T identity() { return string_view::max(); } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { return static_cast(T::max_value()); @@ -167,10 +165,9 @@ struct DeviceMax { return numeric::detail::max(lhs, rhs); } - template < - typename T, - typename std::enable_if_t && !cudf::is_dictionary() && - !cudf::is_fixed_point()>* = nullptr> + template && !cudf::is_dictionary() && + !cudf::is_fixed_point()>* = nullptr> static constexpr T identity() { // chrono types do not have std::numeric_limits specializations and should use T::min() @@ -179,20 +176,20 @@ struct DeviceMax { return cuda::std::numeric_limits::lowest(); } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { CUDF_FAIL("fixed_point does not yet support DeviceMax identity"); return cuda::std::numeric_limits::lowest(); } - template >* = nullptr> + template >* = nullptr> CUDF_HOST_DEVICE inline static constexpr T identity() { return string_view::min(); } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { return static_cast(T::lowest_value()); @@ -203,19 +200,19 @@ struct DeviceMax { * @brief binary `product` operator */ struct DeviceProduct { - template ()>* = nullptr> + template ()>* = nullptr> CUDF_HOST_DEVICE inline auto operator()(const T& lhs, const T& rhs) -> decltype(lhs * rhs) { return lhs * rhs; } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { return T{1}; } - template ()>* = nullptr> + template ()>* = nullptr> static constexpr T identity() { CUDF_FAIL("fixed_point does not yet support DeviceProduct identity"); @@ -227,7 +224,7 @@ struct DeviceProduct { * @brief binary `and` operator */ struct DeviceAnd { - template >* = nullptr> + template >* = nullptr> CUDF_HOST_DEVICE inline auto operator()(const T& lhs, const T& rhs) -> decltype(lhs & rhs) { return (lhs & rhs); @@ -238,7 +235,7 @@ struct DeviceAnd { * @brief binary `or` operator */ struct DeviceOr { - template >* = nullptr> + template >* = nullptr> CUDF_HOST_DEVICE inline auto operator()(const T& lhs, const T& rhs) -> decltype(lhs | rhs) { return (lhs | rhs); @@ -249,7 +246,7 @@ struct DeviceOr { * @brief binary `xor` operator */ struct DeviceXor { - template >* = nullptr> + template >* = nullptr> CUDF_HOST_DEVICE inline auto operator()(const T& lhs, const T& rhs) -> decltype(lhs ^ rhs) { return (lhs ^ rhs); diff --git a/cpp/include/cudf/utilities/span.hpp b/cpp/include/cudf/utilities/span.hpp index 9ccd4d21682c..1172a5a68cdc 100644 --- a/cpp/include/cudf/utilities/span.hpp +++ b/cpp/include/cudf/utilities/span.hpp @@ -159,9 +159,9 @@ struct host_span : public cudf::detail::span_base, - void>::type* = nullptr> + std::enable_if_t<(Extent == OtherExtent || Extent == dynamic_extent) && + std::is_convertible_v, + void>* = nullptr> constexpr host_span(const host_span& other) noexcept : base(other.data(), other.size()) { @@ -220,9 +220,9 @@ struct device_span : public cudf::detail::span_base, - void>::type* = nullptr> + std::enable_if_t<(Extent == OtherExtent || Extent == dynamic_extent) && + std::is_convertible_v, + void>* = nullptr> constexpr device_span(const device_span& other) noexcept : base(other.data(), other.size()) { @@ -283,9 +283,9 @@ class base_2dspan { template typename OtherRowType, - typename std::enable_if, - RowType>, - void>::type* = nullptr> + std::enable_if_t, + RowType>, + void>* = nullptr> constexpr base_2dspan(base_2dspan const& other) noexcept : _data{other.data()}, _size{other.size()} { diff --git a/cpp/include/cudf/utilities/traits.hpp b/cpp/include/cudf/utilities/traits.hpp index f1ad11a90306..504ec6de4050 100644 --- a/cpp/include/cudf/utilities/traits.hpp +++ b/cpp/include/cudf/utilities/traits.hpp @@ -676,13 +676,13 @@ constexpr inline bool is_nested(data_type type) template struct is_bit_castable_to_impl { - template ()>* = nullptr> + template ()>* = nullptr> constexpr bool operator()() { return false; } - template ()>* = nullptr> + template ()>* = nullptr> constexpr bool operator()() { if (not cuda::std::is_trivially_copyable_v || @@ -696,13 +696,13 @@ struct is_bit_castable_to_impl { }; struct is_bit_castable_from_impl { - template ()>* = nullptr> + template ()>* = nullptr> constexpr bool operator()(data_type) { return false; } - template ()>* = nullptr> + template ()>* = nullptr> constexpr bool operator()(data_type to) { return cudf::type_dispatcher(to, is_bit_castable_to_impl{}); diff --git a/cpp/include/cudf_test/column_utilities.hpp b/cpp/include/cudf_test/column_utilities.hpp index aa77686fee48..cd96748f0816 100644 --- a/cpp/include/cudf_test/column_utilities.hpp +++ b/cpp/include/cudf_test/column_utilities.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -178,7 +178,7 @@ bool validate_host_masks(std::vector const& expected_mask, * @return std::pair, std::vector> first is the * `column_view`'s data, and second is the column's bitmask. */ -template ()>* = nullptr> +template ()>* = nullptr> std::pair, std::vector> to_host(column_view c) { thrust::host_vector host_data(c.size()); @@ -197,7 +197,7 @@ std::pair, std::vector> to_host(column_view * @return std::pair, std::vector> first is the * `column_view`'s data, and second is the column's bitmask. */ -template ()>* = nullptr> +template ()>* = nullptr> std::pair, std::vector> to_host(column_view c) { using namespace numeric; diff --git a/cpp/include/cudf_test/column_wrapper.hpp b/cpp/include/cudf_test/column_wrapper.hpp index c190105e2929..4005a4f9adc9 100644 --- a/cpp/include/cudf_test/column_wrapper.hpp +++ b/cpp/include/cudf_test/column_wrapper.hpp @@ -93,31 +93,31 @@ class column_wrapper { template struct fixed_width_type_converter { // Are the types same - simply copy elements from [begin, end) to out - template , void>::type* = nullptr> + template , void>* = nullptr> constexpr ToT operator()(FromT element) const { return element; } // Are the types convertible or can target be constructed from source? - template && - (cudf::is_convertible::value || - std::is_constructible_v), - void>::type* = nullptr> + template < + typename FromT = From, + typename ToT = To, + std::enable_if_t && (cudf::is_convertible::value || + std::is_constructible_v), + void>* = nullptr> constexpr ToT operator()(FromT element) const { return static_cast(element); } // Convert integral values to timestamps - template && cudf::is_timestamp(), - void>::type* = nullptr> + template < + typename FromT = From, + typename ToT = To, + std::enable_if_t && cudf::is_timestamp(), void>* = nullptr> constexpr ToT operator()(FromT element) const { return ToT{typename ToT::duration{element}}; @@ -137,7 +137,7 @@ struct fixed_width_type_converter { template ()>* = nullptr> + std::enable_if_t()>* = nullptr> rmm::device_buffer make_elements(InputIterator begin, InputIterator end) { static_assert(cudf::is_fixed_width(), "Unexpected non-fixed width type."); @@ -162,8 +162,8 @@ rmm::device_buffer make_elements(InputIterator begin, InputIterator end) template () and - cudf::is_fixed_point()>* = nullptr> + std::enable_if_t() and + cudf::is_fixed_point()>* = nullptr> rmm::device_buffer make_elements(InputIterator begin, InputIterator end) { using RepType = typename ElementTo::rep; @@ -187,8 +187,8 @@ rmm::device_buffer make_elements(InputIterator begin, InputIterator end) template () and - cudf::is_fixed_point()>* = nullptr> + std::enable_if_t() and + cudf::is_fixed_point()>* = nullptr> rmm::device_buffer make_elements(InputIterator begin, InputIterator end) { using namespace numeric; diff --git a/cpp/include/cudf_test/type_lists.hpp b/cpp/include/cudf_test/type_lists.hpp index e84417c91d6b..ac2892a0f349 100644 --- a/cpp/include/cudf_test/type_lists.hpp +++ b/cpp/include/cudf_test/type_lists.hpp @@ -80,9 +80,8 @@ constexpr auto types_to_ids() * @return Vector of TypeParam with the values specified */ template -typename std::enable_if() && - !cudf::is_timestamp_t::value, - thrust::host_vector>::type +std::enable_if_t() && !cudf::is_timestamp_t::value, + thrust::host_vector> make_type_param_vector(std::initializer_list const& init_list) { thrust::host_vector vec(init_list.size()); @@ -100,8 +99,7 @@ make_type_param_vector(std::initializer_list const& init_list) * @return Vector of TypeParam with the values specified */ template -typename std::enable_if::value, - thrust::host_vector>::type +std::enable_if_t::value, thrust::host_vector> make_type_param_vector(std::initializer_list const& init_list) { thrust::host_vector vec(init_list.size()); @@ -119,8 +117,7 @@ make_type_param_vector(std::initializer_list const& init_list) */ template -typename std::enable_if, - thrust::host_vector>::type +std::enable_if_t, thrust::host_vector> make_type_param_vector(std::initializer_list const& init_list) { thrust::host_vector vec(init_list.size()); diff --git a/cpp/src/binaryop/compiled/binary_ops.cu b/cpp/src/binaryop/compiled/binary_ops.cu index 995c6702cf82..c45383798360 100644 --- a/cpp/src/binaryop/compiled/binary_ops.cu +++ b/cpp/src/binaryop/compiled/binary_ops.cu @@ -119,9 +119,9 @@ struct compare_functor { // This is used to compare a scalar and a column value template - __device__ inline typename std::enable_if_t && - !std::is_same_v, - OutT> + __device__ inline std::enable_if_t && + !std::is_same_v, + OutT> operator()(cudf::size_type i) const { return cfunc_(lhs_dev_view_.is_valid(i), @@ -133,9 +133,9 @@ struct compare_functor { // This is used to compare a scalar and a column value template - __device__ inline typename std::enable_if_t && - std::is_same_v, - OutT> + __device__ inline std::enable_if_t && + std::is_same_v, + OutT> operator()(cudf::size_type i) const { return cfunc_(lhs_dev_view_.is_valid(), @@ -147,9 +147,9 @@ struct compare_functor { // This is used to compare 2 column values template - __device__ inline typename std::enable_if_t && - std::is_same_v, - OutT> + __device__ inline std::enable_if_t && + std::is_same_v, + OutT> operator()(cudf::size_type i) const { return cfunc_(lhs_dev_view_.is_valid(i), diff --git a/cpp/src/column/column_factories.cpp b/cpp/src/column/column_factories.cpp index fefe0b3c8629..118a08ab26d0 100644 --- a/cpp/src/column/column_factories.cpp +++ b/cpp/src/column/column_factories.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,21 +31,20 @@ namespace cudf { namespace { struct size_of_helper { cudf::data_type type; - template ()>* = nullptr> + template ()>* = nullptr> constexpr int operator()() const { CUDF_FAIL("Invalid, non fixed-width element type."); return 0; } - template () && not is_fixed_point()>* = nullptr> + template () && not is_fixed_point()>* = nullptr> constexpr int operator()() const noexcept { return sizeof(T); } - template ()>* = nullptr> + template ()>* = nullptr> constexpr int operator()() const noexcept { // Only want the sizeof fixed_point::Rep as fixed_point::scale is stored in data_type diff --git a/cpp/src/datetime/datetime_ops.cu b/cpp/src/datetime/datetime_ops.cu index 122ad4a9752f..4dbe9faaa477 100644 --- a/cpp/src/datetime/datetime_ops.cu +++ b/cpp/src/datetime/datetime_ops.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -278,14 +278,14 @@ struct launch_functor { launch_functor(column_view inp, mutable_column_view out) : input(inp), output(out) {} template - typename std::enable_if_t::value, void> operator()( + std::enable_if_t::value, void> operator()( rmm::cuda_stream_view stream) const { CUDF_FAIL("Cannot extract datetime component from non-timestamp column."); } template - typename std::enable_if_t::value, void> operator()( + std::enable_if_t::value, void> operator()( rmm::cuda_stream_view stream) const { thrust::transform(rmm::exec_policy(stream), @@ -326,18 +326,18 @@ std::unique_ptr apply_datetime_op(column_view const& column, struct add_calendrical_months_functor { template - typename std::enable_if_t::value, std::unique_ptr> - operator()(Args&&...) const + std::enable_if_t::value, std::unique_ptr> operator()( + Args&&...) const { CUDF_FAIL("Cannot extract datetime component from non-timestamp column."); } template - typename std::enable_if_t::value, std::unique_ptr> - operator()(column_view timestamp_column, - MonthIterator months_begin, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr) const + std::enable_if_t::value, std::unique_ptr> operator()( + column_view timestamp_column, + MonthIterator months_begin, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) const { auto size = timestamp_column.size(); auto output_col_type = timestamp_column.type(); diff --git a/cpp/src/dictionary/detail/concatenate.cu b/cpp/src/dictionary/detail/concatenate.cu index 301338fa1a8f..871a36f7d620 100644 --- a/cpp/src/dictionary/detail/concatenate.cu +++ b/cpp/src/dictionary/detail/concatenate.cu @@ -122,8 +122,7 @@ struct compute_children_offsets_fn { */ struct dispatch_compute_indices { template - typename std::enable_if_t(), - std::unique_ptr> + std::enable_if_t(), std::unique_ptr> operator()(column_view const& all_keys, column_view const& all_indices, column_view const& new_keys, @@ -184,8 +183,7 @@ struct dispatch_compute_indices { } template - typename std::enable_if_t(), - std::unique_ptr> + std::enable_if_t(), std::unique_ptr> operator()(Args&&...) { CUDF_FAIL("dictionary concatenate not supported for this column type"); diff --git a/cpp/src/dictionary/set_keys.cu b/cpp/src/dictionary/set_keys.cu index c1fb1fa21808..7783e5f8dafc 100644 --- a/cpp/src/dictionary/set_keys.cu +++ b/cpp/src/dictionary/set_keys.cu @@ -50,8 +50,7 @@ namespace { */ struct dispatch_compute_indices { template - typename std::enable_if_t(), - std::unique_ptr> + std::enable_if_t(), std::unique_ptr> operator()(dictionary_column_view const& input, column_view const& new_keys, rmm::cuda_stream_view stream, @@ -100,8 +99,7 @@ struct dispatch_compute_indices { } template - typename std::enable_if_t(), - std::unique_ptr> + std::enable_if_t(), std::unique_ptr> operator()(Args&&...) { CUDF_FAIL("dictionary set_keys not supported for this column type"); diff --git a/cpp/src/filling/sequence.cu b/cpp/src/filling/sequence.cu index c49142f91f90..e5bffcf21c18 100644 --- a/cpp/src/filling/sequence.cu +++ b/cpp/src/filling/sequence.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,9 +55,8 @@ struct const_tabulator { * by init and step. */ struct sequence_functor { - template < - typename T, - typename std::enable_if_t() and not cudf::is_boolean()>* = nullptr> + template () and not cudf::is_boolean()>* = nullptr> std::unique_ptr operator()(size_type size, scalar const& init, scalar const& step, @@ -83,9 +82,8 @@ struct sequence_functor { return result; } - template < - typename T, - typename std::enable_if_t() and not cudf::is_boolean()>* = nullptr> + template () and not cudf::is_boolean()>* = nullptr> std::unique_ptr operator()(size_type size, scalar const& init, rmm::cuda_stream_view stream, diff --git a/cpp/src/groupby/sort/group_nunique.cu b/cpp/src/groupby/sort/group_nunique.cu index 5154c867095f..37d13d5aea32 100644 --- a/cpp/src/groupby/sort/group_nunique.cu +++ b/cpp/src/groupby/sort/group_nunique.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,14 +33,14 @@ namespace detail { namespace { struct nunique_functor { template - typename std::enable_if_t(), std::unique_ptr> - operator()(column_view const& values, - cudf::device_span group_labels, - size_type const num_groups, - cudf::device_span group_offsets, - null_policy null_handling, - rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr) + std::enable_if_t(), std::unique_ptr> operator()( + column_view const& values, + cudf::device_span group_labels, + size_type const num_groups, + cudf::device_span group_offsets, + null_policy null_handling, + rmm::cuda_stream_view stream, + rmm::mr::device_memory_resource* mr) { auto result = make_numeric_column( data_type(type_to_id()), num_groups, mask_state::UNALLOCATED, stream, mr); @@ -94,8 +94,8 @@ struct nunique_functor { } template - typename std::enable_if_t(), std::unique_ptr> - operator()(Args&&...) + std::enable_if_t(), std::unique_ptr> operator()( + Args&&...) { CUDF_FAIL("list_view group_nunique not supported yet"); } diff --git a/cpp/src/groupby/sort/group_tdigest.cu b/cpp/src/groupby/sort/group_tdigest.cu index f48ab852f24c..f726de9bf3c9 100644 --- a/cpp/src/groupby/sort/group_tdigest.cu +++ b/cpp/src/groupby/sort/group_tdigest.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -707,9 +707,8 @@ struct get_scalar_minmax { }; struct typed_group_tdigest { - template < - typename T, - typename std::enable_if_t() || cudf::is_fixed_point()>* = nullptr> + template () || cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& col, cudf::device_span group_offsets, cudf::device_span group_labels, @@ -766,10 +765,9 @@ struct typed_group_tdigest { mr); } - template < - typename T, - typename... Args, - typename std::enable_if_t() && !cudf::is_fixed_point()>* = nullptr> + template () && !cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(Args&&...) { CUDF_FAIL("Non-numeric type in group_tdigest"); diff --git a/cpp/src/io/csv/csv_gpu.cu b/cpp/src/io/csv/csv_gpu.cu index 13f5a57ac1f6..e2e478af9efa 100644 --- a/cpp/src/io/csv/csv_gpu.cu +++ b/cpp/src/io/csv/csv_gpu.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -375,8 +375,8 @@ struct decode_op { * @return bool Whether the parsed value is valid. */ template and !std::is_same_v and - !cudf::is_fixed_point()>* = nullptr> + std::enable_if_t and !std::is_same_v and + !cudf::is_fixed_point()>* = nullptr> __host__ __device__ __forceinline__ bool operator()(void* out_buffer, size_t row, const data_type, @@ -402,7 +402,7 @@ struct decode_op { * * @return bool Whether the parsed value is valid. */ - template ()>* = nullptr> + template ()>* = nullptr> __host__ __device__ __forceinline__ bool operator()(void* out_buffer, size_t row, const data_type output_type, @@ -423,7 +423,7 @@ struct decode_op { /** * @brief Dispatch for boolean type types. */ - template >* = nullptr> + template >* = nullptr> __host__ __device__ __forceinline__ bool operator()(void* out_buffer, size_t row, const data_type, @@ -447,7 +447,7 @@ struct decode_op { * @brief Dispatch for floating points, which are set to NaN if the input * is not valid. In such case, the validity mask is set to zero too. */ - template >* = nullptr> + template >* = nullptr> __host__ __device__ __forceinline__ bool operator()(void* out_buffer, size_t row, const data_type, @@ -466,8 +466,8 @@ struct decode_op { * @brief Dispatch for all other types. */ template and !std::is_floating_point_v and - !cudf::is_fixed_point()>* = nullptr> + std::enable_if_t and !std::is_floating_point_v and + !cudf::is_fixed_point()>* = nullptr> __host__ __device__ __forceinline__ bool operator()(void* out_buffer, size_t row, const data_type, diff --git a/cpp/src/io/json/json_gpu.cu b/cpp/src/io/json/json_gpu.cu index 5cf0b03a6f17..21455e3ab93e 100644 --- a/cpp/src/io/json/json_gpu.cu +++ b/cpp/src/io/json/json_gpu.cu @@ -216,7 +216,7 @@ struct ConvertFunctor { * It is handled here rather than within convertStrToValue() as that function * is used by other types (ex. timestamp) that aren't 'booleable'. */ - template >* = nullptr> + template >* = nullptr> __host__ __device__ __forceinline__ bool operator()(char const* begin, char const* end, void* output_column, @@ -240,7 +240,7 @@ struct ConvertFunctor { * @brief Dispatch for floating points, which are set to NaN if the input * is not valid. In such case, the validity mask is set to zero too. */ - template >* = nullptr> + template >* = nullptr> __host__ __device__ __forceinline__ bool operator()(char const* begin, char const* end, void* out_buffer, @@ -257,9 +257,8 @@ struct ConvertFunctor { * @brief Default template operator() dispatch specialization all data types * (including wrapper types) that is not covered by above. */ - template < - typename T, - typename std::enable_if_t and !std::is_integral_v>* = nullptr> + template and !std::is_integral_v>* = nullptr> __host__ __device__ __forceinline__ bool operator()(char const* begin, char const* end, void* output_column, diff --git a/cpp/src/io/orc/orc.h b/cpp/src/io/orc/orc.h index 386e3d8d73ab..470200234199 100644 --- a/cpp/src/io/orc/orc.h +++ b/cpp/src/io/orc/orc.h @@ -137,56 +137,51 @@ int inline constexpr encode_field_number(int field_number, ProtofType field_type } namespace { -template < - typename base_t, - typename std::enable_if_t and !std::is_enum_v>* = nullptr> +template and !std::is_enum_v>* = nullptr> int static constexpr encode_field_number_base(int field_number) noexcept { return encode_field_number(field_number, ProtofType::FIXEDLEN); } -template < - typename base_t, - typename std::enable_if_t or std::is_enum_v>* = nullptr> +template or std::is_enum_v>* = nullptr> int static constexpr encode_field_number_base(int field_number) noexcept { return encode_field_number(field_number, ProtofType::VARINT); } -template >* = nullptr> +template >* = nullptr> int static constexpr encode_field_number_base(int field_number) noexcept { return encode_field_number(field_number, ProtofType::FIXED32); } -template >* = nullptr> +template >* = nullptr> int static constexpr encode_field_number_base(int field_number) noexcept { return encode_field_number(field_number, ProtofType::FIXED64); } }; // namespace -template < - typename T, - typename std::enable_if_t or std::is_same_v>* = nullptr> +template or std::is_same_v>* = nullptr> int constexpr encode_field_number(int field_number) noexcept { return encode_field_number_base(field_number); } // containters change the field number encoding -template < - typename T, - typename std::enable_if_t>>* = nullptr> +template >>* = nullptr> int constexpr encode_field_number(int field_number) noexcept { return encode_field_number_base(field_number); } // optional fields don't change the field number encoding -template < - typename T, - typename std::enable_if_t>>* = nullptr> +template >>* = nullptr> int constexpr encode_field_number(int field_number) noexcept { return encode_field_number_base(field_number); @@ -244,19 +239,19 @@ class ProtobufReader { uint32_t read_field_size(const uint8_t* end); - template >* = nullptr> + template >* = nullptr> void read_field(T& value, const uint8_t* end) { value = get(); } - template >* = nullptr> + template >* = nullptr> void read_field(T& value, const uint8_t* end) { value = static_cast(get()); } - template >* = nullptr> + template >* = nullptr> void read_field(T& value, const uint8_t* end) { auto const size = read_field_size(end); @@ -264,8 +259,7 @@ class ProtobufReader { m_cur += size; } - template >>* = nullptr> + template >>* = nullptr> void read_field(T& value, const uint8_t* end) { auto const size = read_field_size(end); @@ -273,10 +267,9 @@ class ProtobufReader { m_cur += size; } - template < - typename T, - typename std::enable_if_t> and - !std::is_same_v>* = nullptr> + template > and + !std::is_same_v>* = nullptr> void read_field(T& value, const uint8_t* end) { auto const size = read_field_size(end); @@ -284,9 +277,8 @@ class ProtobufReader { read(value.back(), size); } - template < - typename T, - typename std::enable_if_t>>* = nullptr> + template >>* = nullptr> void read_field(T& value, const uint8_t* end) { typename T::value_type contained_value; @@ -301,7 +293,7 @@ class ProtobufReader { read(value, size); } - template >* = nullptr> + template >* = nullptr> void read_field(T& value, const uint8_t* end) { memcpy(&value, m_cur, sizeof(T)); diff --git a/cpp/src/io/utilities/parsing_utils.cuh b/cpp/src/io/utilities/parsing_utils.cuh index d1b2e2862c6c..74b98eff010e 100644 --- a/cpp/src/io/utilities/parsing_utils.cuh +++ b/cpp/src/io/utilities/parsing_utils.cuh @@ -98,7 +98,7 @@ struct parse_options { * * @return uint8_t Numeric value of the character, or `0` */ -template >* = nullptr> +template >* = nullptr> constexpr uint8_t decode_digit(char c, bool* valid_flag) { if (c >= '0' && c <= '9') return c - '0'; @@ -119,7 +119,7 @@ constexpr uint8_t decode_digit(char c, bool* valid_flag) * * @return uint8_t Numeric value of the character, or `0` */ -template >* = nullptr> +template >* = nullptr> constexpr uint8_t decode_digit(char c, bool* valid_flag) { if (c >= '0' && c <= '9') return c - '0'; diff --git a/cpp/src/reductions/scan/scan_exclusive.cu b/cpp/src/reductions/scan/scan_exclusive.cu index bf9b06a3602e..9811a986224c 100644 --- a/cpp/src/reductions/scan/scan_exclusive.cu +++ b/cpp/src/reductions/scan/scan_exclusive.cu @@ -50,7 +50,7 @@ struct scan_dispatcher { * @param mr Device memory resource used to allocate the returned column's device memory * @return Output column with scan results */ - template >* = nullptr> + template >* = nullptr> std::unique_ptr operator()(column_view const& input, null_policy, rmm::cuda_stream_view stream, diff --git a/cpp/src/reductions/scan/scan_inclusive.cu b/cpp/src/reductions/scan/scan_inclusive.cu index bf2c83b5b8dc..ee865f09f2e6 100644 --- a/cpp/src/reductions/scan/scan_inclusive.cu +++ b/cpp/src/reductions/scan/scan_inclusive.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -225,7 +225,7 @@ struct scan_dispatcher { * * @tparam T type of input column */ - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(column_view const& input, null_policy, rmm::cuda_stream_view stream, diff --git a/cpp/src/reductions/simple.cuh b/cpp/src/reductions/simple.cuh index 7dc8e6cb2c4f..e5303246452a 100644 --- a/cpp/src/reductions/simple.cuh +++ b/cpp/src/reductions/simple.cuh @@ -260,8 +260,7 @@ struct same_element_type_dispatcher { return !(cudf::is_dictionary() || std::is_same_v); } - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr resolve_key(column_view const& keys, scalar const& keys_index, rmm::cuda_stream_view stream, @@ -271,8 +270,7 @@ struct same_element_type_dispatcher { return cudf::detail::get_element(keys, index.value(stream), stream, mr); } - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr resolve_key(column_view const&, scalar const&, rmm::cuda_stream_view, @@ -353,7 +351,7 @@ struct element_type_dispatcher { * @brief Specialization for reducing floating-point column types to any output type. */ template >* = nullptr> + std::enable_if_t>* = nullptr> std::unique_ptr reduce_numeric(column_view const& col, data_type const output_type, rmm::cuda_stream_view stream, @@ -375,8 +373,7 @@ struct element_type_dispatcher { /** * @brief Specialization for reducing integer column types to any output type. */ - template >* = nullptr> + template >* = nullptr> std::unique_ptr reduce_numeric(column_view const& col, data_type const output_type, rmm::cuda_stream_view stream, @@ -405,8 +402,7 @@ struct element_type_dispatcher { * @param stream CUDA stream used for device memory operations and kernel launches. * @param mr Device memory resource used to allocate the returned scalar's device memory */ - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(column_view const& col, data_type const output_type, rmm::cuda_stream_view stream, @@ -423,8 +419,7 @@ struct element_type_dispatcher { /** * @brief Specialization for reducing fixed_point column types to fixed_point number */ - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(column_view const& col, data_type const output_type, rmm::cuda_stream_view stream, @@ -436,8 +431,8 @@ struct element_type_dispatcher { } template () and - not cudf::is_fixed_point()>* = nullptr> + std::enable_if_t() and + not cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const&, data_type const, rmm::cuda_stream_view, diff --git a/cpp/src/replace/nulls.cu b/cpp/src/replace/nulls.cu index 93bc6cf5ae53..d41bdb6ca5a8 100644 --- a/cpp/src/replace/nulls.cu +++ b/cpp/src/replace/nulls.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -297,8 +297,7 @@ struct replace_nulls_functor { * `replace_nulls` with the appropriate data types. */ struct replace_nulls_scalar_kernel_forwarder { - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, cudf::scalar const& replacement, rmm::cuda_stream_view stream, diff --git a/cpp/src/reshape/interleave_columns.cu b/cpp/src/reshape/interleave_columns.cu index 0e3ead3fd991..cd66cad392e6 100644 --- a/cpp/src/reshape/interleave_columns.cu +++ b/cpp/src/reshape/interleave_columns.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ struct interleave_columns_functor { }; template -struct interleave_columns_impl>> { +struct interleave_columns_impl>> { std::unique_ptr operator()(table_view const& lists_columns, bool create_mask, rmm::cuda_stream_view stream, @@ -64,7 +64,7 @@ struct interleave_columns_impl -struct interleave_columns_impl>> { +struct interleave_columns_impl>> { std::unique_ptr operator()(table_view const& structs_columns, bool create_mask, rmm::cuda_stream_view stream, @@ -131,7 +131,7 @@ struct interleave_columns_impl -struct interleave_columns_impl>> { +struct interleave_columns_impl>> { std::unique_ptr operator()(table_view const& strings_columns, bool create_mask, rmm::cuda_stream_view stream, @@ -214,7 +214,7 @@ struct interleave_columns_impl -struct interleave_columns_impl()>> { +struct interleave_columns_impl()>> { std::unique_ptr operator()(table_view const& input, bool create_mask, rmm::cuda_stream_view stream, diff --git a/cpp/src/rolling/rolling_detail.cuh b/cpp/src/rolling/rolling_detail.cuh index 7c52856b1471..958da04e57c2 100644 --- a/cpp/src/rolling/rolling_detail.cuh +++ b/cpp/src/rolling/rolling_detail.cuh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, NVIDIA CORPORATION. + * Copyright (c) 2020-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,14 +91,14 @@ struct DeviceRolling { // operations we do support template - DeviceRolling(size_type _min_periods, typename std::enable_if_t()>* = nullptr) + DeviceRolling(size_type _min_periods, std::enable_if_t()>* = nullptr) : min_periods(_min_periods) { } // operations we don't support template - DeviceRolling(size_type _min_periods, typename std::enable_if_t()>* = nullptr) + DeviceRolling(size_type _min_periods, std::enable_if_t()>* = nullptr) : min_periods(_min_periods) { CUDF_FAIL("Invalid aggregation/type pair"); @@ -441,12 +441,12 @@ struct DeviceRollingLead { return cudf::is_fixed_width(); } - template ()>* = nullptr> + template ()>* = nullptr> DeviceRollingLead(size_type _row_offset) : row_offset(_row_offset) { } - template ()>* = nullptr> + template ()>* = nullptr> DeviceRollingLead(size_type _row_offset) : row_offset(_row_offset) { CUDF_FAIL("Invalid aggregation/type pair"); @@ -497,12 +497,12 @@ struct DeviceRollingLag { return cudf::is_fixed_width(); } - template ()>* = nullptr> + template ()>* = nullptr> DeviceRollingLag(size_type _row_offset) : row_offset(_row_offset) { } - template ()>* = nullptr> + template ()>* = nullptr> DeviceRollingLag(size_type _row_offset) : row_offset(_row_offset) { CUDF_FAIL("Invalid aggregation/type pair"); diff --git a/cpp/src/round/round.cu b/cpp/src/round/round.cu index 81bf03f7c0ac..9a2b10029978 100644 --- a/cpp/src/round/round.cu +++ b/cpp/src/round/round.cu @@ -49,26 +49,26 @@ inline double __device__ generic_round_half_even(double d) { return rint(d); } inline float __device__ generic_modf(float a, float* b) { return modff(a, b); } inline double __device__ generic_modf(double a, double* b) { return modf(a, b); } -template >* = nullptr> +template >* = nullptr> T __device__ generic_abs(T value) { return numeric::detail::abs(value); } -template >* = nullptr> +template >* = nullptr> T __device__ generic_abs(T value) { return value; } -template >* = nullptr> +template >* = nullptr> int16_t __device__ generic_sign(T value) { return value < 0 ? -1 : 1; } // this is needed to suppress warning: pointless comparison of unsigned integer with zero -template >* = nullptr> +template >* = nullptr> int16_t __device__ generic_sign(T) { return 1; @@ -83,13 +83,13 @@ constexpr inline auto is_supported_round_type() template struct half_up_zero { T n; // unused in the decimal_places = 0 case - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { return generic_round(e); } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U) { assert(false); // Should never get here. Just for compilation @@ -100,7 +100,7 @@ struct half_up_zero { template struct half_up_positive { T n; - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { T integer_part; @@ -108,7 +108,7 @@ struct half_up_positive { return integer_part + generic_round(fractional_part * n) / n; } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U) { assert(false); // Should never get here. Just for compilation @@ -119,13 +119,13 @@ struct half_up_positive { template struct half_up_negative { T n; - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { return generic_round(e / n) * n; } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U e) { auto const down = (e / n) * n; // result from rounding down @@ -136,13 +136,13 @@ struct half_up_negative { template struct half_even_zero { T n; // unused in the decimal_places = 0 case - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { return generic_round_half_even(e); } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U) { assert(false); // Should never get here. Just for compilation @@ -153,7 +153,7 @@ struct half_even_zero { template struct half_even_positive { T n; - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { T integer_part; @@ -161,7 +161,7 @@ struct half_even_positive { return integer_part + generic_round_half_even(fractional_part * n) / n; } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U) { assert(false); // Should never get here. Just for compilation @@ -172,13 +172,13 @@ struct half_even_positive { template struct half_even_negative { T n; - template ()>* = nullptr> + template ()>* = nullptr> __device__ U operator()(U e) { return generic_round_half_even(e / n) * n; } - template >* = nullptr> + template >* = nullptr> __device__ U operator()(U e) { auto const down_over_n = e / n; // use this to determine HALF_EVEN case @@ -205,7 +205,7 @@ struct half_even_fixed_point { template typename RoundFunctor, - typename std::enable_if_t()>* = nullptr> + std::enable_if_t()>* = nullptr> std::unique_ptr round_with(column_view const& input, int32_t decimal_places, rmm::cuda_stream_view stream, @@ -231,7 +231,7 @@ std::unique_ptr round_with(column_view const& input, template typename RoundFunctor, - typename std::enable_if_t()>* = nullptr> + std::enable_if_t()>* = nullptr> std::unique_ptr round_with(column_view const& input, int32_t decimal_places, rmm::cuda_stream_view stream, diff --git a/cpp/src/scalar/scalar_factories.cpp b/cpp/src/scalar/scalar_factories.cpp index c18b57d220f9..3a2920f8f1aa 100644 --- a/cpp/src/scalar/scalar_factories.cpp +++ b/cpp/src/scalar/scalar_factories.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +28,8 @@ namespace cudf { namespace { struct scalar_construction_helper { template , - typename std::enable_if_t() and not is_fixed_point()>* = nullptr> + typename ScalarType = scalar_type_t, + std::enable_if_t() and not is_fixed_point()>* = nullptr> std::unique_ptr operator()(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) const { @@ -39,8 +39,8 @@ struct scalar_construction_helper { } template , - typename std::enable_if_t()>* = nullptr> + typename ScalarType = scalar_type_t, + std::enable_if_t()>* = nullptr> std::unique_ptr operator()(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) const { @@ -49,9 +49,7 @@ struct scalar_construction_helper { return std::unique_ptr(s); } - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(Args... args) const { CUDF_FAIL("Invalid type."); @@ -124,14 +122,14 @@ namespace { struct default_scalar_functor { data_type type; - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { return make_fixed_width_scalar(data_type(type_to_id()), stream, mr); } - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { diff --git a/cpp/src/sort/sort.cu b/cpp/src/sort/sort.cu index 42b57bdb47a0..5ce82cd37403 100644 --- a/cpp/src/sort/sort.cu +++ b/cpp/src/sort/sort.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ std::unique_ptr sort_by_key(table_view const& values, } struct inplace_column_sort_fn { - template ()>* = nullptr> + template ()>* = nullptr> void operator()(mutable_column_view& col, bool ascending, rmm::cuda_stream_view stream) const { CUDF_EXPECTS(!col.has_nulls(), "Nulls not supported for in-place sort"); @@ -68,7 +68,7 @@ struct inplace_column_sort_fn { } } - template ()>* = nullptr> + template ()>* = nullptr> void operator()(mutable_column_view&, bool, rmm::cuda_stream_view) const { CUDF_FAIL("Column type must be relationally comparable and fixed-width"); diff --git a/cpp/src/sort/sort_column.cu b/cpp/src/sort/sort_column.cu index 74c796e79624..7a4072cf8ae5 100644 --- a/cpp/src/sort/sort_column.cu +++ b/cpp/src/sort/sort_column.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ struct column_sorted_order_fn { * @param ascending True if sort order is ascending * @param stream CUDA stream used for device memory operations and kernel launches */ - template ()>* = nullptr> + template ()>* = nullptr> void radix_sort(column_view const& input, mutable_column_view& indices, bool ascending, @@ -68,7 +68,7 @@ struct column_sorted_order_fn { thrust::greater()); } } - template ()>* = nullptr> + template ()>* = nullptr> void radix_sort(column_view const&, mutable_column_view&, bool, rmm::cuda_stream_view) { CUDF_FAIL("Only fixed-width types are suitable for faster sorting"); @@ -85,8 +85,7 @@ struct column_sorted_order_fn { * @param null_precedence How null rows are to be ordered * @param stream CUDA stream used for device memory operations and kernel launches */ - template ()>* = nullptr> + template ()>* = nullptr> void operator()(column_view const& input, mutable_column_view& indices, bool ascending, @@ -105,8 +104,7 @@ struct column_sorted_order_fn { } } - template ()>* = nullptr> + template ()>* = nullptr> void operator()(column_view const&, mutable_column_view&, bool, null_order, rmm::cuda_stream_view) { CUDF_FAIL("Column type must be relationally comparable"); diff --git a/cpp/src/sort/stable_sort_column.cu b/cpp/src/sort/stable_sort_column.cu index 49aecf526251..d79a691a580f 100644 --- a/cpp/src/sort/stable_sort_column.cu +++ b/cpp/src/sort/stable_sort_column.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ struct column_stable_sorted_order_fn { * @param indices Output sorted indices * @param stream CUDA stream used for device memory operations and kernel launches */ - template ()>* = nullptr> + template ()>* = nullptr> void faster_stable_sort(column_view const& input, mutable_column_view& indices, rmm::cuda_stream_view stream) @@ -38,7 +38,7 @@ struct column_stable_sorted_order_fn { thrust::stable_sort_by_key( rmm::exec_policy(stream), d_col.begin(), d_col.end(), indices.begin()); } - template ()>* = nullptr> + template ()>* = nullptr> void faster_stable_sort(column_view const&, mutable_column_view&, rmm::cuda_stream_view) { CUDF_FAIL("Only fixed-width types are suitable for faster stable sorting"); @@ -55,8 +55,7 @@ struct column_stable_sorted_order_fn { * @param null_precedence How null rows are to be ordered * @param stream CUDA stream used for device memory operations and kernel launches */ - template ()>* = nullptr> + template ()>* = nullptr> void operator()(column_view const& input, mutable_column_view& indices, bool ascending, @@ -74,8 +73,7 @@ struct column_stable_sorted_order_fn { faster_stable_sort(input, indices, stream); } } - template ()>* = nullptr> + template ()>* = nullptr> void operator()(column_view const&, mutable_column_view&, bool, null_order, rmm::cuda_stream_view) { CUDF_FAIL("Column type must be relationally comparable"); diff --git a/cpp/src/unary/cast_ops.cu b/cpp/src/unary/cast_ops.cu index 5cc4ce5f6c9d..f77ab7aa3d9b 100644 --- a/cpp/src/unary/cast_ops.cu +++ b/cpp/src/unary/cast_ops.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,19 +34,19 @@ namespace detail { namespace { // anonymous namespace template struct unary_cast { - template () && - cudf::is_numeric())>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_numeric() && cudf::is_numeric())>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return static_cast(element); } - template () && - cudf::is_timestamp())>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_timestamp() && cudf::is_timestamp())>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { // Convert source tick counts into target tick counts without blindly truncating them @@ -55,46 +55,46 @@ struct unary_cast { return TargetT{cuda::std::chrono::floor(element.time_since_epoch())}; } - template () && - cudf::is_duration())>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_duration() && cudf::is_duration())>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return TargetT{cuda::std::chrono::floor(element)}; } - template () && - cudf::is_duration()>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t() && cudf::is_duration()>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return TargetT{static_cast(element)}; } - template () && - cudf::is_duration())>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_timestamp() && cudf::is_duration())>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return TargetT{cuda::std::chrono::floor(element.time_since_epoch())}; } - template () && - cudf::is_numeric()>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t() && cudf::is_numeric()>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return static_cast(element.count()); } - template () && - cudf::is_timestamp())>* = nullptr> + template < + typename SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_duration() && cudf::is_timestamp())>* = nullptr> __device__ inline TargetT operator()(SourceT const element) { return TargetT{cuda::std::chrono::floor(element)}; @@ -107,20 +107,20 @@ struct fixed_point_unary_cast { using FixedPointT = std::conditional_t(), _SourceT, _TargetT>; using DeviceT = device_storage_type_t; - template () && - cudf::is_numeric())>* = nullptr> + template < + typename SourceT = _SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_fixed_point<_SourceT>() && cudf::is_numeric())>* = nullptr> __device__ inline TargetT operator()(DeviceT const element) { auto const fp = SourceT{numeric::scaled_integer{element, scale}}; return static_cast(fp); } - template () && - cudf::is_fixed_point())>* = nullptr> + template < + typename SourceT = _SourceT, + typename TargetT = _TargetT, + std::enable_if_t<(cudf::is_numeric<_SourceT>() && cudf::is_fixed_point())>* = nullptr> __device__ inline DeviceT operator()(SourceT const element) { return TargetT{element, scale}.value(); @@ -169,7 +169,7 @@ struct device_cast { * * @return std::unique_ptr Returned column with new @p scale */ -template ()>* = nullptr> +template ()>* = nullptr> std::unique_ptr rescale(column_view input, numeric::scale_type scale, rmm::cuda_stream_view stream, @@ -207,10 +207,9 @@ struct dispatch_unary_cast_to { dispatch_unary_cast_to(column_view inp) : input(inp) {} - template < - typename TargetT, - typename SourceT = _SourceT, - typename std::enable_if_t()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -234,10 +233,10 @@ struct dispatch_unary_cast_to { return output; } - template () && - cudf::is_numeric()>* = nullptr> + template < + typename TargetT, + typename SourceT = _SourceT, + std::enable_if_t() && cudf::is_numeric()>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -264,10 +263,10 @@ struct dispatch_unary_cast_to { return output; } - template () && - cudf::is_fixed_point()>* = nullptr> + template < + typename TargetT, + typename SourceT = _SourceT, + std::enable_if_t() && cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -294,11 +293,10 @@ struct dispatch_unary_cast_to { return output; } - template < - typename TargetT, - typename SourceT = _SourceT, - typename std::enable_if_t() && cudf::is_fixed_point() && - std::is_same_v>* = nullptr> + template () && cudf::is_fixed_point() && + std::is_same_v>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -310,11 +308,10 @@ struct dispatch_unary_cast_to { return detail::rescale(input, numeric::scale_type{type.scale()}, stream, mr); } - template < - typename TargetT, - typename SourceT = _SourceT, - typename std::enable_if_t() && cudf::is_fixed_point() && - not std::is_same_v>* = nullptr> + template () && cudf::is_fixed_point() && + not std::is_same_v>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -356,8 +353,8 @@ struct dispatch_unary_cast_to { } template ()>* = nullptr> + typename SourceT = _SourceT, + std::enable_if_t()>* = nullptr> std::unique_ptr operator()(data_type, rmm::cuda_stream_view, rmm::mr::device_memory_resource*) @@ -379,7 +376,7 @@ struct dispatch_unary_cast_from { dispatch_unary_cast_from(column_view inp) : input(inp) {} - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(data_type type, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) diff --git a/cpp/src/unary/math_ops.cu b/cpp/src/unary/math_ops.cu index 474c7b76ddcf..e92d5a1ca7e2 100644 --- a/cpp/src/unary/math_ops.cu +++ b/cpp/src/unary/math_ops.cu @@ -348,7 +348,7 @@ std::unique_ptr transform_fn(cudf::dictionary_column_view const& i template struct MathOpDispatcher { - template >* = nullptr> + template >* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -362,7 +362,7 @@ struct MathOpDispatcher { } struct dictionary_dispatch { - template >* = nullptr> + template >* = nullptr> std::unique_ptr operator()(cudf::dictionary_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -377,9 +377,9 @@ struct MathOpDispatcher { } }; - template and - std::is_same_v>* = nullptr> + template < + typename T, + std::enable_if_t and std::is_same_v>* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -401,7 +401,7 @@ struct MathOpDispatcher { template struct BitwiseOpDispatcher { - template >* = nullptr> + template >* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -415,7 +415,7 @@ struct BitwiseOpDispatcher { } struct dictionary_dispatch { - template >* = nullptr> + template >* = nullptr> std::unique_ptr operator()(cudf::dictionary_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -431,8 +431,7 @@ struct BitwiseOpDispatcher { }; template and std::is_same_v>* = - nullptr> + std::enable_if_t and std::is_same_v>* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -462,7 +461,7 @@ struct LogicalOpDispatcher { } public: - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -477,7 +476,7 @@ struct LogicalOpDispatcher { } struct dictionary_dispatch { - template ()>* = nullptr> + template ()>* = nullptr> std::unique_ptr operator()(cudf::dictionary_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) @@ -499,9 +498,8 @@ struct LogicalOpDispatcher { } }; - template < - typename T, - typename std::enable_if_t() and std::is_same_v>* = nullptr> + template () and std::is_same_v>* = nullptr> std::unique_ptr operator()(cudf::column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) diff --git a/cpp/tests/binaryop/binop-fixture.hpp b/cpp/tests/binaryop/binop-fixture.hpp index 65243b1ae2e5..2ba5561826e2 100644 --- a/cpp/tests/binaryop/binop-fixture.hpp +++ b/cpp/tests/binaryop/binop-fixture.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Copyright 2018-2019 BlazingDB, Inc. * Copyright 2018 Christian Noboa Mardini @@ -61,14 +61,14 @@ struct BinaryOperationTest : public cudf::test::BaseFixture { return cudf::test::fixed_width_column_wrapper(data_iter, data_iter + size, validity_iter); } - template >* = nullptr> + template >* = nullptr> auto make_random_wrapped_scalar() { cudf::test::UniformRandomGenerator rand_gen(r_min, r_max); return cudf::scalar_type_t(rand_gen.generate()); } - template >* = nullptr> + template >* = nullptr> auto make_random_wrapped_scalar() { cudf::test::UniformRandomGenerator rand_gen(r_min, r_max); diff --git a/cpp/tests/binaryop/util/operation.h b/cpp/tests/binaryop/util/operation.h index d78ad8938c40..93a84a7bc49a 100644 --- a/cpp/tests/binaryop/util/operation.h +++ b/cpp/tests/binaryop/util/operation.h @@ -32,19 +32,19 @@ template struct Add { // Allow sum between chronos only when both input and output types // are chronos. Unsupported combinations will fail to compile - template () && cudf::is_chrono() && - cudf::is_chrono(), - void>::type* = nullptr> + template () && cudf::is_chrono() && + cudf::is_chrono(), + void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { return lhs + rhs; } - template () || !cudf::is_chrono() || - !cudf::is_chrono(), - void>::type* = nullptr> + template () || !cudf::is_chrono() || + !cudf::is_chrono(), + void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { using TypeCommon = typename std::common_type::type; @@ -56,19 +56,19 @@ template struct Sub { // Allow difference between chronos only when both input and output types // are chronos. Unsupported combinations will fail to compile - template () && cudf::is_chrono() && - cudf::is_chrono(), - void>::type* = nullptr> + template () && cudf::is_chrono() && + cudf::is_chrono(), + void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { return lhs - rhs; } - template () || !cudf::is_chrono() || - !cudf::is_chrono(), - void>::type* = nullptr> + template () || !cudf::is_chrono() || + !cudf::is_chrono(), + void>* = nullptr> OutT operator()(TypeLhs lhs, TypeRhs rhs) const { using TypeCommon = typename std::common_type::type; @@ -78,28 +78,27 @@ struct Sub { template struct Mul { - template ::value, void>::type* = nullptr> + template ::value, void>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) const { using TypeCommon = typename std::common_type::type; return static_cast(static_cast(lhs) * static_cast(rhs)); } - template ::value, void>::type* = nullptr> + template ::value, void>* = nullptr> TypeOut operator()(TypeLhs x, TypeRhs y) const { return DurationProduct(x, y); } - template < - typename OutT, - typename LhsT, - typename RhsT, - typename std::enable_if<(cudf::is_duration_t::value && std::is_integral_v) || - (cudf::is_duration_t::value && std::is_integral_v), - void>::type* = nullptr> + template ::value && std::is_integral_v) || + (cudf::is_duration_t::value && std::is_integral_v), + void>* = nullptr> OutT DurationProduct(LhsT x, RhsT y) const { return x * y; @@ -108,26 +107,26 @@ struct Mul { template struct Div { - template ::value, void>::type* = nullptr> + template ::value, void>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { using TypeCommon = typename std::common_type::type; return static_cast(static_cast(lhs) / static_cast(rhs)); } - template ::value, void>::type* = nullptr> + template ::value, void>* = nullptr> TypeOut operator()(TypeLhs x, TypeRhs y) const { return DurationDivide(x, y); } - template || cudf::is_duration()), - void>::type* = nullptr> + template < + typename OutT, + typename LhsT, + typename RhsT, + std::enable_if_t<(std::is_integral_v || cudf::is_duration()), void>* = nullptr> OutT DurationDivide(LhsT x, RhsT y) const { return x / y; @@ -185,10 +184,10 @@ struct Mod { } // Mod with duration types - duration % (integral or a duration) = duration - template ::value && - cudf::is_duration_t::value>* = nullptr> + template ::value && + cudf::is_duration_t::value>* = nullptr> TypeOut operator()(TypeLhs lhs, TypeRhs rhs) { return lhs % rhs; diff --git a/cpp/tests/copying/copy_tests.cpp b/cpp/tests/copying/copy_tests.cpp index 4254794bf191..62f1300c2842 100644 --- a/cpp/tests/copying/copy_tests.cpp +++ b/cpp/tests/copying/copy_tests.cpp @@ -378,18 +378,16 @@ TYPED_TEST(CopyTestNumeric, CopyIfElseTestScalarScalar) template struct create_chrono_scalar { template - typename std::enable_if_t< - std::is_same_v::type, std::true_type>, - cudf::timestamp_scalar> + std::enable_if_t::type, std::true_type>, + cudf::timestamp_scalar> operator()(Args&&... args) const { return cudf::timestamp_scalar(std::forward(args)...); } template - typename std::enable_if_t< - std::is_same_v::type, std::true_type>, - cudf::duration_scalar> + std::enable_if_t::type, std::true_type>, + cudf::duration_scalar> operator()(Args&&... args) const { return cudf::duration_scalar(std::forward(args)...); diff --git a/cpp/tests/device_atomics/device_atomics_test.cu b/cpp/tests/device_atomics/device_atomics_test.cu index fd065249c4e0..31174d3fd729 100644 --- a/cpp/tests/device_atomics/device_atomics_test.cu +++ b/cpp/tests/device_atomics/device_atomics_test.cu @@ -51,7 +51,7 @@ constexpr inline bool is_timestamp_sum() // Disable SUM of TIMESTAMP types template ()>* = nullptr> + std::enable_if_t()>* = nullptr> __device__ T atomic_op(T* addr, T const& value, BinaryOp op) { return {}; @@ -59,7 +59,7 @@ __device__ T atomic_op(T* addr, T const& value, BinaryOp op) template ()>* = nullptr> + std::enable_if_t()>* = nullptr> __device__ T atomic_op(T* addr, T const& value, BinaryOp op) { T old_value = *addr; @@ -92,13 +92,13 @@ __global__ void gpu_atomicCAS_test(T* result, T* data, size_t size) } template -typename std::enable_if_t(), T> accumulate(cudf::host_span xs) +std::enable_if_t(), T> accumulate(cudf::host_span xs) { return std::accumulate(xs.begin(), xs.end(), T{0}); } template -typename std::enable_if_t(), T> accumulate(cudf::host_span xs) +std::enable_if_t(), T> accumulate(cudf::host_span xs) { auto ys = std::vector(xs.size()); std::transform( diff --git a/cpp/tests/groupby/tdigest_tests.cu b/cpp/tests/groupby/tdigest_tests.cu index 2591f395914d..b0ce22bae7c7 100644 --- a/cpp/tests/groupby/tdigest_tests.cu +++ b/cpp/tests/groupby/tdigest_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,9 +60,8 @@ struct column_max { }; struct tdigest_gen { - template < - typename T, - typename std::enable_if_t() || cudf::is_fixed_point()>* = nullptr> + template () || cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta) { cudf::table_view t({keys}); @@ -75,9 +74,8 @@ struct tdigest_gen { return std::move(result.second[0].results[0]); } - template < - typename T, - typename std::enable_if_t() && !cudf::is_fixed_point()>* = nullptr> + template () && !cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta) { CUDF_FAIL("Invalid tdigest test type"); diff --git a/cpp/tests/io/csv_test.cpp b/cpp/tests/io/csv_test.cpp index 08cdbb103599..e5e44b1aa6ee 100644 --- a/cpp/tests/io/csv_test.cpp +++ b/cpp/tests/io/csv_test.cpp @@ -262,7 +262,7 @@ void check_string_column(cudf::column_view const& col_lhs, } // Helper function to compare two floating-point column contents -template >* = nullptr> +template >* = nullptr> void expect_column_data_equal(std::vector const& lhs, cudf::column_view const& rhs) { EXPECT_THAT(cudf::test::to_host(rhs).first, @@ -270,7 +270,7 @@ void expect_column_data_equal(std::vector const& lhs, cudf::column_view const } // Helper function to compare two column contents -template >* = nullptr> +template >* = nullptr> void expect_column_data_equal(std::vector const& lhs, cudf::column_view const& rhs) { EXPECT_THAT(cudf::test::to_host(rhs).first, ::testing::ElementsAreArray(lhs)); diff --git a/cpp/tests/quantiles/percentile_approx_test.cu b/cpp/tests/quantiles/percentile_approx_test.cu index 2f4d5a7a6040..035cd664aa27 100644 --- a/cpp/tests/quantiles/percentile_approx_test.cu +++ b/cpp/tests/quantiles/percentile_approx_test.cu @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include @@ -21,9 +36,8 @@ using namespace cudf; using namespace cudf::tdigest; struct tdigest_gen { - template < - typename T, - typename std::enable_if_t() || cudf::is_fixed_point()>* = nullptr> + template () || cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta) { cudf::table_view t({keys}); @@ -36,9 +50,8 @@ struct tdigest_gen { return std::move(result.second[0].results[0]); } - template < - typename T, - typename std::enable_if_t() && !cudf::is_fixed_point()>* = nullptr> + template () && !cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta) { CUDF_FAIL("Invalid tdigest test type"); @@ -89,9 +102,8 @@ std::unique_ptr arrow_percentile_approx(column_view const& _values, } struct percentile_approx_dispatch { - template < - typename T, - typename std::enable_if_t() || cudf::is_fixed_point()>* = nullptr> + template () || cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta, @@ -127,9 +139,8 @@ struct percentile_approx_dispatch { return result; } - template < - typename T, - typename std::enable_if_t() && !cudf::is_fixed_point()>* = nullptr> + template () && !cudf::is_fixed_point()>* = nullptr> std::unique_ptr operator()(column_view const& keys, column_view const& values, int delta, diff --git a/cpp/tests/reductions/reduction_tests.cpp b/cpp/tests/reductions/reduction_tests.cpp index fcecc1249786..276b244dac6f 100644 --- a/cpp/tests/reductions/reduction_tests.cpp +++ b/cpp/tests/reductions/reduction_tests.cpp @@ -38,7 +38,7 @@ using aggregation = cudf::aggregation; template -typename std::enable_if::value, std::vector>::type convert_values( +std::enable_if_t::value, std::vector> convert_values( std::vector const& int_values) { std::vector v(int_values.size()); @@ -50,7 +50,7 @@ typename std::enable_if::value, std::vector>::type c } template -typename std::enable_if::value, std::vector>::type convert_values( +std::enable_if_t::value, std::vector> convert_values( std::vector const& int_values) { std::vector v(int_values.size()); diff --git a/cpp/tests/reductions/scan_tests.hpp b/cpp/tests/reductions/scan_tests.hpp index 346103de85be..858697d8ef51 100644 --- a/cpp/tests/reductions/scan_tests.hpp +++ b/cpp/tests/reductions/scan_tests.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,25 +58,23 @@ struct TypeParam_to_host_type { }; template -typename std::enable_if, - thrust::host_vector>::type +std::enable_if_t, thrust::host_vector> make_vector(std::initializer_list const& init) { return cudf::test::make_type_param_vector(init); } template -typename std::enable_if(), - thrust::host_vector>::type +std::enable_if_t(), thrust::host_vector> make_vector(std::initializer_list const& init) { return cudf::test::make_type_param_vector(init); } template -typename std::enable_if || - cudf::is_fixed_point()), - thrust::host_vector>::type +std::enable_if_t || + cudf::is_fixed_point()), + thrust::host_vector> make_vector(std::initializer_list const& init) { return cudf::test::make_type_param_vector(init); diff --git a/cpp/tests/sort/is_sorted_tests.cpp b/cpp/tests/sort/is_sorted_tests.cpp index 7d277059ef71..44fa83204ee7 100644 --- a/cpp/tests/sort/is_sorted_tests.cpp +++ b/cpp/tests/sort/is_sorted_tests.cpp @@ -36,8 +36,7 @@ namespace testdata { // ----- most numerics template -typename std::enable_if && !std::is_same_v, - fixed_width_column_wrapper>::type +std::enable_if_t && !std::is_same_v, fixed_width_column_wrapper> ascending() { return std::is_signed_v ? fixed_width_column_wrapper({std::numeric_limits::lowest(), @@ -58,8 +57,7 @@ ascending() } template -typename std::enable_if && !std::is_same_v, - fixed_width_column_wrapper>::type +std::enable_if_t && !std::is_same_v, fixed_width_column_wrapper> descending() { return std::is_signed_v ? fixed_width_column_wrapper({std::numeric_limits::max(), @@ -100,14 +98,13 @@ auto nulls_before() // ----- bool template -typename std::enable_if, fixed_width_column_wrapper>::type ascending() +std::enable_if_t, fixed_width_column_wrapper> ascending() { return fixed_width_column_wrapper({false, false, true, true}); } template -typename std::enable_if, fixed_width_column_wrapper>::type -descending() +std::enable_if_t, fixed_width_column_wrapper> descending() { return fixed_width_column_wrapper({true, true, false, false}); } @@ -115,13 +112,13 @@ descending() // ----- chrono types template -typename std::enable_if(), fixed_width_column_wrapper>::type ascending() +std::enable_if_t(), fixed_width_column_wrapper> ascending() { return fixed_width_column_wrapper({T::min(), T::max()}); } template -typename std::enable_if(), fixed_width_column_wrapper>::type descending() +std::enable_if_t(), fixed_width_column_wrapper> descending() { return fixed_width_column_wrapper({T::max(), T::min()}); } @@ -129,15 +126,13 @@ typename std::enable_if(), fixed_width_column_wrapper>::ty // ----- string_view template -typename std::enable_if, strings_column_wrapper>::type -ascending() +std::enable_if_t, strings_column_wrapper> ascending() { return strings_column_wrapper({"A", "B"}); } template -typename std::enable_if, strings_column_wrapper>::type -descending() +std::enable_if_t, strings_column_wrapper> descending() { return strings_column_wrapper({"B", "A"}); } @@ -163,8 +158,7 @@ auto nulls_before() // ----- struct_view {"nestedInt" : {"Int" : 0 }, "float" : 1} template -typename std::enable_if, structs_column_wrapper>::type -ascending() +std::enable_if_t, structs_column_wrapper> ascending() { using T1 = int32_t; auto int_col = fixed_width_column_wrapper({std::numeric_limits::lowest(), @@ -182,8 +176,7 @@ ascending() } template -typename std::enable_if, structs_column_wrapper>::type -descending() +std::enable_if_t, structs_column_wrapper> descending() { using T1 = int32_t; auto int_col = fixed_width_column_wrapper({std::numeric_limits::max(), diff --git a/cpp/tests/utilities/column_utilities.cu b/cpp/tests/utilities/column_utilities.cu index 5403d56318e0..9daf70227f8a 100644 --- a/cpp/tests/utilities/column_utilities.cu +++ b/cpp/tests/utilities/column_utilities.cu @@ -836,13 +836,13 @@ std::vector bitmask_to_host(cudf::column_view const& c) namespace { -template >* = nullptr> +template >* = nullptr> static auto numeric_to_string_precise(T value) { return std::to_string(value); } -template >* = nullptr> +template >* = nullptr> static auto numeric_to_string_precise(T value) { std::ostringstream o; @@ -915,7 +915,7 @@ std::string nested_offsets_to_string(NestedColumnView const& c, std::string cons } struct column_view_printer { - template ()>* = nullptr> + template ()>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const&) { auto h_data = cudf::test::to_host(col); @@ -939,7 +939,7 @@ struct column_view_printer { } } - template ()>* = nullptr> + template ()>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const& indent) @@ -965,7 +965,7 @@ struct column_view_printer { this->template operator()(*col_as_strings, out, indent); } - template ()>* = nullptr> + template ()>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const&) { auto const h_data = cudf::test::to_host(col); @@ -987,7 +987,7 @@ struct column_view_printer { } template >* = nullptr> + std::enable_if_t>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const&) { // @@ -1008,7 +1008,7 @@ struct column_view_printer { } template >* = nullptr> + std::enable_if_t>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const&) { cudf::dictionary_column_view dictionary(col); @@ -1029,7 +1029,7 @@ struct column_view_printer { } // Print the tick counts with the units - template ()>* = nullptr> + template ()>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const&) { auto h_data = cudf::test::to_host(col); @@ -1054,8 +1054,7 @@ struct column_view_printer { } } - template >* = nullptr> + template >* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const& indent) @@ -1084,7 +1083,7 @@ struct column_view_printer { } template >* = nullptr> + std::enable_if_t>* = nullptr> void operator()(cudf::column_view const& col, std::vector& out, std::string const& indent) diff --git a/cpp/tests/wrappers/timestamps_test.cu b/cpp/tests/wrappers/timestamps_test.cu index 097b786aefe2..48500c84942e 100644 --- a/cpp/tests/wrappers/timestamps_test.cu +++ b/cpp/tests/wrappers/timestamps_test.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ struct compare_chrono_elements_to_primitive_representation { { } - template ()>* = nullptr> + template ()>* = nullptr> __host__ __device__ bool operator()(const int32_t element_index) { using Primitive = typename ChronoT::rep; @@ -59,7 +59,7 @@ struct compare_chrono_elements_to_primitive_representation { return primitive == timestamp.time_since_epoch().count(); } - template ()>* = nullptr> + template ()>* = nullptr> __host__ __device__ bool operator()(const int32_t element_index) { using Primitive = typename ChronoT::rep;