Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cpp deprecation. #10010

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/common/transform_iterator.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
/**
Expand Down
6 changes: 3 additions & 3 deletions src/data/array_interface.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019-2023 by XGBoost Contributors
* Copyright 2019-2024, XGBoost Contributors
* \file array_interface.h
* \brief View of __array_interface__
*/
Expand All @@ -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>

Expand Down Expand Up @@ -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>
Expand Down
9 changes: 5 additions & 4 deletions src/data/proxy_dmatrix.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* Copyright 2020-2023, XGBoost contributors
* Copyright 2020-2024, XGBoost contributors
*/
#ifndef XGBOOST_DATA_PROXY_DMATRIX_H_
#define XGBOOST_DATA_PROXY_DMATRIX_H_

#include <any> // for any, any_cast
#include <memory>
#include <string>
#include <type_traits> // for invoke_result_t
#include <utility>

#include "adapter.h"
Expand Down Expand Up @@ -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>>())>();
}
}
}
Expand Down
Loading