Fixes for C++20 support.
Various things are deprecated or removed in C++20, including * Various allocator member types * std::iterator * std::result_of Replace these with supported versions. Bug: chromium:1284275 Change-Id: I11a2909e3a269cdb98ada2bd6621086409878242 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89040 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Peter Kasting <pkasting@google.com> Commit-Queue: Peter Kasting <pkasting@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
7cbd8202e6
commit
d3921b8230
|
@ -34,8 +34,8 @@
|
||||||
template <typename T, size_t stack_capacity>
|
template <typename T, size_t stack_capacity>
|
||||||
class StackAllocator : public std::allocator<T> {
|
class StackAllocator : public std::allocator<T> {
|
||||||
public:
|
public:
|
||||||
typedef typename std::allocator<T>::pointer pointer;
|
typedef typename std::allocator_traits<std::allocator<T>>::pointer pointer;
|
||||||
typedef typename std::allocator<T>::size_type size_type;
|
typedef typename std::allocator_traits<std::allocator<T>>::size_type size_type;
|
||||||
|
|
||||||
// Backing store for the allocator. The container owner is responsible for
|
// Backing store for the allocator. The container owner is responsible for
|
||||||
// maintaining this for as long as any containers using this allocator are
|
// maintaining this for as long as any containers using this allocator are
|
||||||
|
|
|
@ -53,8 +53,14 @@ class ParamGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Iterator : public std::iterator<std::forward_iterator_tag, ParamStruct, size_t> {
|
class Iterator {
|
||||||
public:
|
public:
|
||||||
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
using value_type = ParamStruct;
|
||||||
|
using difference_type = size_t;
|
||||||
|
using pointer = ParamStruct*;
|
||||||
|
using reference = ParamStruct&;
|
||||||
|
|
||||||
Iterator& operator++() {
|
Iterator& operator++() {
|
||||||
// Increment the Index by 1. If the i'th place reaches the maximum,
|
// Increment the Index by 1. If the i'th place reaches the maximum,
|
||||||
// reset it to 0 and continue with the i+1'th place.
|
// reset it to 0 and continue with the i+1'th place.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -366,7 +367,7 @@ class CloneContext {
|
||||||
/// references of the original object. A type mismatch will result in an
|
/// references of the original object. A type mismatch will result in an
|
||||||
/// assertion in debug builds, and undefined behavior in release builds.
|
/// assertion in debug builds, and undefined behavior in release builds.
|
||||||
/// @returns this CloneContext so calls can be chained
|
/// @returns this CloneContext so calls can be chained
|
||||||
template <typename WHAT, typename WITH, typename = std::result_of_t<WITH()>>
|
template <typename WHAT, typename WITH, typename = std::invoke_result_t<WITH>>
|
||||||
CloneContext& Replace(const WHAT* what, WITH&& with) {
|
CloneContext& Replace(const WHAT* what, WITH&& with) {
|
||||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, what);
|
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, what);
|
||||||
replacements_[what] = with;
|
replacements_[what] = with;
|
||||||
|
|
Loading…
Reference in New Issue