aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornadya73 <nadya73@yandex-team.com>2024-11-18 14:46:50 +0300
committernadya73 <nadya73@yandex-team.com>2024-11-18 14:59:08 +0300
commit13bff9a72fbc1bd6a2643251982afcc3b4a7e93a (patch)
tree10d9e3eb389b74f3c0bbc64ad5923eb59ad8c379
parenta04215d91c3179d9a5a0332e3b2c94feed8fbe3b (diff)
downloadydb-13bff9a72fbc1bd6a2643251982afcc3b4a7e93a.tar.gz
YT-22431: Don't use deprecated std::result_of in contrib/libs/apache/arrow
commit_hash:b59cf7dbe69a28e5b49c7def237a8a05fc5cfe4e
-rw-r--r--contrib/libs/apache/arrow/cpp/src/arrow/result.h4
-rw-r--r--contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h2
-rw-r--r--contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h2
-rw-r--r--contrib/libs/apache/arrow/cpp/src/arrow/util/future.h11
-rw-r--r--contrib/libs/apache/arrow/patches/no_result_of.patch64
5 files changed, 78 insertions, 5 deletions
diff --git a/contrib/libs/apache/arrow/cpp/src/arrow/result.h b/contrib/libs/apache/arrow/cpp/src/arrow/result.h
index cb7437cd24..af4a72f65e 100644
--- a/contrib/libs/apache/arrow/cpp/src/arrow/result.h
+++ b/contrib/libs/apache/arrow/cpp/src/arrow/result.h
@@ -385,7 +385,7 @@ class ARROW_MUST_USE_TYPE Result : public util::EqualityComparable<Result<T>> {
/// Apply a function to the internally stored value to produce a new result or propagate
/// the stored error.
template <typename M>
- typename EnsureResult<typename std::result_of<M && (T)>::type>::type Map(M&& m) && {
+ typename EnsureResult<decltype(std::declval<M&&>()(std::declval<T&&>()))>::type Map(M&& m) && {
if (!ok()) {
return status();
}
@@ -395,7 +395,7 @@ class ARROW_MUST_USE_TYPE Result : public util::EqualityComparable<Result<T>> {
/// Apply a function to the internally stored value to produce a new result or propagate
/// the stored error.
template <typename M>
- typename EnsureResult<typename std::result_of<M && (const T&)>::type>::type Map(
+ typename EnsureResult<decltype(std::declval<M&&>()(std::declval<const T&>()))>::type Map(
M&& m) const& {
if (!ok()) {
return status();
diff --git a/contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h b/contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h
index 129fa91323..6b900f246f 100644
--- a/contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h
+++ b/contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h
@@ -62,7 +62,7 @@ void GenerateBits(uint8_t* bitmap, int64_t start_offset, int64_t length, Generat
template <class Generator>
void GenerateBitsUnrolled(uint8_t* bitmap, int64_t start_offset, int64_t length,
Generator&& g) {
- static_assert(std::is_same<typename std::result_of<Generator && ()>::type, bool>::value,
+ static_assert(std::is_same<decltype(std::declval<Generator>()()), bool>::value,
"Functor passed to GenerateBitsUnrolled must return bool");
if (length == 0) {
diff --git a/contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h b/contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h
index 9da79046fe..41e268852f 100644
--- a/contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h
+++ b/contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h
@@ -129,7 +129,7 @@ class FnOnce<R(A...)> {
template <typename Fn,
typename = typename std::enable_if<std::is_convertible<
- typename std::result_of<Fn && (A...)>::type, R>::value>::type>
+ decltype(std::declval<Fn&&>()(std::declval<A>()...)), R>::value>::type>
FnOnce(Fn fn) : impl_(new FnImpl<Fn>(std::move(fn))) { // NOLINT runtime/explicit
}
diff --git a/contrib/libs/apache/arrow/cpp/src/arrow/util/future.h b/contrib/libs/apache/arrow/cpp/src/arrow/util/future.h
index d9e0a939f2..2b8c522096 100644
--- a/contrib/libs/apache/arrow/cpp/src/arrow/util/future.h
+++ b/contrib/libs/apache/arrow/cpp/src/arrow/util/future.h
@@ -47,8 +47,17 @@ struct is_future : std::false_type {};
template <typename T>
struct is_future<Future<T>> : std::true_type {};
+template <typename Signature, typename Enable = void>
+struct result_of;
+
+template <typename Fn, typename... A>
+struct result_of<Fn(A...),
+ std::void_t<decltype(std::declval<Fn>()(std::declval<A>()...))>> {
+ using type = decltype(std::declval<Fn>()(std::declval<A>()...));
+};
+
template <typename Signature>
-using result_of_t = typename std::result_of<Signature>::type;
+using result_of_t = typename result_of<Signature>::type;
// Helper to find the synchronous counterpart for a Future
template <typename T>
diff --git a/contrib/libs/apache/arrow/patches/no_result_of.patch b/contrib/libs/apache/arrow/patches/no_result_of.patch
new file mode 100644
index 0000000000..e75e1109e8
--- /dev/null
+++ b/contrib/libs/apache/arrow/patches/no_result_of.patch
@@ -0,0 +1,64 @@
+--- contrib/libs/apache/arrow/cpp/src/arrow/result.h (2e0006a95f0ad665eca5b48386842a8a0354061f)
++++ contrib/libs/apache/arrow/cpp/src/arrow/result.h (working tree)
+@@ -385,7 +385,7 @@ class ARROW_MUST_USE_TYPE Result : public util::EqualityComparable<Result<T>> {
+ /// Apply a function to the internally stored value to produce a new result or propagate
+ /// the stored error.
+ template <typename M>
+- typename EnsureResult<typename std::result_of<M && (T)>::type>::type Map(M&& m) && {
++ typename EnsureResult<decltype(std::declval<M&&>()(std::declval<T&&>()))>::type Map(M&& m) && {
+ if (!ok()) {
+ return status();
+ }
+@@ -395,7 +395,7 @@ class ARROW_MUST_USE_TYPE Result : public util::EqualityComparable<Result<T>> {
+ /// Apply a function to the internally stored value to produce a new result or propagate
+ /// the stored error.
+ template <typename M>
+- typename EnsureResult<typename std::result_of<M && (const T&)>::type>::type Map(
++ typename EnsureResult<decltype(std::declval<M&&>()(std::declval<const T&>()))>::type Map(
+ M&& m) const& {
+ if (!ok()) {
+ return status();
+--- contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h (2e0006a95f0ad665eca5b48386842a8a0354061f)
++++ contrib/libs/apache/arrow/cpp/src/arrow/util/bitmap_generate.h (working tree)
+@@ -62,7 +62,7 @@ void GenerateBits(uint8_t* bitmap, int64_t start_offset, int64_t length, Generat
+ template <class Generator>
+ void GenerateBitsUnrolled(uint8_t* bitmap, int64_t start_offset, int64_t length,
+ Generator&& g) {
+- static_assert(std::is_same<typename std::result_of<Generator && ()>::type, bool>::value,
++ static_assert(std::is_same<decltype(std::declval<Generator>()()), bool>::value,
+ "Functor passed to GenerateBitsUnrolled must return bool");
+
+ if (length == 0) {
+--- contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h (2e0006a95f0ad665eca5b48386842a8a0354061f)
++++ contrib/libs/apache/arrow/cpp/src/arrow/util/functional.h (working tree)
+@@ -129,7 +129,7 @@ class FnOnce<R(A...)> {
+
+ template <typename Fn,
+ typename = typename std::enable_if<std::is_convertible<
+- typename std::result_of<Fn && (A...)>::type, R>::value>::type>
++ decltype(std::declval<Fn&&>()(std::declval<A>()...)), R>::value>::type>
+ FnOnce(Fn fn) : impl_(new FnImpl<Fn>(std::move(fn))) { // NOLINT runtime/explicit
+ }
+
+--- contrib/libs/apache/arrow/cpp/src/arrow/util/future.h (2e0006a95f0ad665eca5b48386842a8a0354061f)
++++ contrib/libs/apache/arrow/cpp/src/arrow/util/future.h (working tree)
+@@ -47,8 +47,17 @@ struct is_future : std::false_type {};
+ template <typename T>
+ struct is_future<Future<T>> : std::true_type {};
+
++template <typename Signature, typename Enable = void>
++struct result_of;
++
++template <typename Fn, typename... A>
++struct result_of<Fn(A...),
++ std::void_t<decltype(std::declval<Fn>()(std::declval<A>()...))>> {
++ using type = decltype(std::declval<Fn>()(std::declval<A>()...));
++};
++
+ template <typename Signature>
+-using result_of_t = typename std::result_of<Signature>::type;
++using result_of_t = typename result_of<Signature>::type;
+
+ // Helper to find the synchronous counterpart for a Future
+ template <typename T>
+