Mesa (main): clover: std::result_of is deprecated in c++17 and removed in c++20
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 27 19:03:42 UTC 2021
Module: Mesa
Branch: main
Commit: 38e36df7cb4e18f771c19ed6b7a24d2f89099b3d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=38e36df7cb4e18f771c19ed6b7a24d2f89099b3d
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Sun Sep 26 11:03:56 2021 -0700
clover: std::result_of is deprecated in c++17 and removed in c++20
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12273>
---
src/gallium/frontends/clover/meson.build | 1 +
src/gallium/frontends/clover/util/adaptor.hpp | 5 ++--
src/gallium/frontends/clover/util/compat.hpp | 43 +++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build
index b6a231f9790..e6aed0fcb51 100644
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -148,6 +148,7 @@ clover_files = files(
'util/adaptor.hpp',
'util/algebra.hpp',
'util/algorithm.hpp',
+ 'util/compat.hpp',
'util/factor.hpp',
'util/functional.hpp',
'util/lazy.hpp',
diff --git a/src/gallium/frontends/clover/util/adaptor.hpp b/src/gallium/frontends/clover/util/adaptor.hpp
index e9035968573..08601fc416b 100644
--- a/src/gallium/frontends/clover/util/adaptor.hpp
+++ b/src/gallium/frontends/clover/util/adaptor.hpp
@@ -25,6 +25,7 @@
#include <iterator>
+#include "util/compat.hpp"
#include "util/tuple.hpp"
#include "util/pointer.hpp"
#include "util/functional.hpp"
@@ -43,8 +44,8 @@ namespace clover {
class iterator_adaptor {
public:
typedef std::forward_iterator_tag iterator_category;
- typedef typename std::result_of<
- F(typename std::iterator_traits<Is>::reference...)
+ typedef typename invoke_result<
+ F, typename std::iterator_traits<Is>::reference...
>::type reference;
typedef typename std::remove_reference<reference>::type value_type;
typedef pseudo_ptr<value_type> pointer;
diff --git a/src/gallium/frontends/clover/util/compat.hpp b/src/gallium/frontends/clover/util/compat.hpp
new file mode 100644
index 00000000000..dd8db8d2c51
--- /dev/null
+++ b/src/gallium/frontends/clover/util/compat.hpp
@@ -0,0 +1,43 @@
+//
+// Copyright © Microsoft Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifndef CLOVER_UTIL_COMPAT_HPP
+#define CLOVER_UTIL_COMPAT_HPP
+
+#include <type_traits>
+
+namespace clover {
+ template<typename F, typename... Args>
+ struct invoke_result {
+#if __cplusplus >= 201703L
+ typedef typename std::invoke_result<
+ F, Args...
+ >::type type;
+#else
+ typedef typename std::result_of<
+ F(Args...)
+ >::type type;
+#endif
+ };
+}
+
+#endif
More information about the mesa-commit
mailing list