diff --git a/src/common/common.h b/src/common/common.h index d83b58d6ce98..f7872afd7f4d 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -177,7 +177,7 @@ class IndexTransformIter { public: using iterator_category = std::random_access_iterator_tag; // NOLINT - using value_type = std::result_of_t; // NOLINT + using value_type = std::invoke_result_t; // NOLINT using difference_type = detail::ptrdiff_t; // NOLINT using reference = std::add_lvalue_reference_t; // NOLINT using pointer = std::add_pointer_t; // NOLINT diff --git a/src/common/linalg_op.cuh b/src/common/linalg_op.cuh index 558a09ca6acb..f19bfdeba409 100644 --- a/src/common/linalg_op.cuh +++ b/src/common/linalg_op.cuh @@ -14,7 +14,7 @@ namespace linalg { template void ElementWiseKernelDevice(linalg::TensorView t, Fn&& fn, cudaStream_t s = nullptr) { dh::safe_cuda(cudaSetDevice(t.DeviceIdx())); - static_assert(std::is_void>::value, + static_assert(std::is_void>::value, "For function with return, use transform instead."); if (t.Contiguous()) { auto ptr = t.Values().data(); diff --git a/src/common/linalg_op.h b/src/common/linalg_op.h index 26cb405f526f..ee965a4ad5d4 100644 --- a/src/common/linalg_op.h +++ b/src/common/linalg_op.h @@ -28,7 +28,7 @@ void ElementWiseTransformHost(linalg::TensorView t, int32_t n_threads, Fn& template void ElementWiseKernelHost(linalg::TensorView t, int32_t n_threads, Fn&& fn) { - static_assert(std::is_void>::value, + static_assert(std::is_void>::value, "For function with return, use transform instead."); if (t.Contiguous()) { auto ptr = t.Values().data(); diff --git a/src/data/proxy_dmatrix.h b/src/data/proxy_dmatrix.h index 8375c7c8d6c1..af6216f5975e 100644 --- a/src/data/proxy_dmatrix.h +++ b/src/data/proxy_dmatrix.h @@ -127,15 +127,13 @@ inline DMatrixProxy* MakeProxy(DMatrixHandle proxy) { template decltype(auto) HostAdapterDispatch(DMatrixProxy const* proxy, Fn fn, bool* type_error = nullptr) { if (proxy->Adapter().type() == typeid(std::shared_ptr)) { - auto value = - dmlc::get>(proxy->Adapter())->Value(); + auto value = dmlc::get>(proxy->Adapter())->Value(); if (type_error) { *type_error = false; } return fn(value); } else if (proxy->Adapter().type() == typeid(std::shared_ptr)) { - auto value = dmlc::get>( - proxy->Adapter())->Value(); + auto value = dmlc::get>(proxy->Adapter())->Value(); if (type_error) { *type_error = false; } @@ -146,8 +144,8 @@ decltype(auto) HostAdapterDispatch(DMatrixProxy const* proxy, Fn fn, bool* type_ } else { LOG(FATAL) << "Unknown type: " << proxy->Adapter().type().name(); } - return std::result_of_t>()->Value()))>(); + return std::invoke_result_t>()->Value())>(); } } } // namespace data