Fix cpp deprecation. (#10010)
This commit is contained in:
parent
d3f2dbe64f
commit
a76d6c6131
@ -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 <cstddef> // std::size_t
|
||||
#include <iterator> // std::random_access_iterator_tag
|
||||
#include <type_traits> // std::result_of_t, std::add_pointer_t, std::add_lvalue_reference_t
|
||||
#include <type_traits> // for invoke_result_t, add_pointer_t, add_lvalue_reference_t
|
||||
#include <utility> // 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<Fn(std::size_t)>; // NOLINT
|
||||
using value_type = std::remove_cv_t<std::remove_reference_t<reference>>; // NOLINT
|
||||
using difference_type = detail::ptrdiff_t; // NOLINT
|
||||
using pointer = std::add_pointer_t<value_type>; // NOLINT
|
||||
using iterator_category = std::random_access_iterator_tag; // NOLINT
|
||||
using reference = std::invoke_result_t<Fn, std::size_t>; // NOLINT
|
||||
using value_type = std::remove_cv_t<std::remove_reference_t<reference>>; // NOLINT
|
||||
using difference_type = detail::ptrdiff_t; // NOLINT
|
||||
using pointer = std::add_pointer_t<value_type>; // NOLINT
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@ -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 <limits> // for numeric_limits
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <type_traits> // std::alignment_of,std::remove_pointer_t
|
||||
#include <type_traits> // for alignment_of, remove_pointer_t, invoke_result_t
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -643,7 +643,7 @@ auto DispatchDType(ArrayInterfaceHandler::Type dtype, Fn dispatch) {
|
||||
}
|
||||
}
|
||||
|
||||
return std::result_of_t<Fn(std::int8_t)>();
|
||||
return std::invoke_result_t<Fn, std::int8_t>();
|
||||
}
|
||||
|
||||
template <std::int32_t D, typename Fn>
|
||||
|
||||
@ -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 <any> // for any, any_cast
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <type_traits> // for invoke_result_t
|
||||
#include <utility>
|
||||
|
||||
#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<Fn(
|
||||
decltype(std::declval<std::shared_ptr<ArrayAdapter>>()->Value()))>();
|
||||
return std::invoke_result_t<
|
||||
Fn, decltype(std::declval<std::shared_ptr<ArrayAdapter>>()->Value())>();
|
||||
} else {
|
||||
return std::result_of_t<Fn(decltype(std::declval<std::shared_ptr<ArrayAdapter>>()))>();
|
||||
return std::invoke_result_t<Fn, decltype(std::declval<std::shared_ptr<ArrayAdapter>>())>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user