diff --git a/src/common/transform_iterator.h b/src/common/transform_iterator.h index 2efb0b72539c..8125bd852cc5 100644 --- a/src/common/transform_iterator.h +++ b/src/common/transform_iterator.h @@ -1,12 +1,12 @@ /** - * Copyright 2022 by XGBoost Contributors + * Copyright 2022-2024, XGBoost Contributors */ #ifndef XGBOOST_COMMON_TRANSFORM_ITERATOR_H_ #define XGBOOST_COMMON_TRANSFORM_ITERATOR_H_ #include // std::size_t #include // std::random_access_iterator_tag -#include // std::result_of_t, std::add_pointer_t, std::add_lvalue_reference_t +#include // for invoke_result_t, add_pointer_t, add_lvalue_reference_t #include // std::forward #include "xgboost/span.h" // ptrdiff_t @@ -25,11 +25,11 @@ class IndexTransformIter { Fn fn_; public: - using iterator_category = std::random_access_iterator_tag; // NOLINT - using reference = std::result_of_t; // NOLINT - using value_type = std::remove_cv_t>; // NOLINT - using difference_type = detail::ptrdiff_t; // NOLINT - using pointer = std::add_pointer_t; // NOLINT + using iterator_category = std::random_access_iterator_tag; // NOLINT + using reference = std::invoke_result_t; // NOLINT + using value_type = std::remove_cv_t>; // NOLINT + using difference_type = detail::ptrdiff_t; // NOLINT + using pointer = std::add_pointer_t; // NOLINT public: /** diff --git a/src/data/array_interface.h b/src/data/array_interface.h index 6f2438f37196..d645c9e755d6 100644 --- a/src/data/array_interface.h +++ b/src/data/array_interface.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2023 by XGBoost Contributors + * Copyright 2019-2024, XGBoost Contributors * \file array_interface.h * \brief View of __array_interface__ */ @@ -12,7 +12,7 @@ #include // for numeric_limits #include #include -#include // std::alignment_of,std::remove_pointer_t +#include // for alignment_of, remove_pointer_t, invoke_result_t #include #include @@ -643,7 +643,7 @@ auto DispatchDType(ArrayInterfaceHandler::Type dtype, Fn dispatch) { } } - return std::result_of_t(); + return std::invoke_result_t(); } template diff --git a/src/data/proxy_dmatrix.h b/src/data/proxy_dmatrix.h index 544c4c81c9a3..7efff7af4bb1 100644 --- a/src/data/proxy_dmatrix.h +++ b/src/data/proxy_dmatrix.h @@ -1,5 +1,5 @@ /** - * Copyright 2020-2023, XGBoost contributors + * Copyright 2020-2024, XGBoost contributors */ #ifndef XGBOOST_DATA_PROXY_DMATRIX_H_ #define XGBOOST_DATA_PROXY_DMATRIX_H_ @@ -7,6 +7,7 @@ #include // for any, any_cast #include #include +#include // for invoke_result_t #include #include "adapter.h" @@ -171,10 +172,10 @@ decltype(auto) HostAdapterDispatch(DMatrixProxy const* proxy, Fn fn, bool* type_ LOG(FATAL) << "Unknown type: " << proxy->Adapter().type().name(); } if constexpr (get_value) { - return std::result_of_t>()->Value()))>(); + return std::invoke_result_t< + Fn, decltype(std::declval>()->Value())>(); } else { - return std::result_of_t>()))>(); + return std::invoke_result_t>())>(); } } }