clover: std::result_of is deprecated in c++17 and removed in c++20

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12273>
This commit is contained in:
Jesse Natalie
2021-09-26 11:03:56 -07:00
committed by Marge Bot
parent 7371efdb3a
commit 38e36df7cb
3 changed files with 47 additions and 2 deletions

View File

@@ -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',

View File

@@ -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;

View File

@@ -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