diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-06-28 19:38:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-09 15:28:00 +0000 |
commit | 762dbfe09d2d0c0b5c9c1e210d67d403fa9fd5f7 (patch) | |
tree | 523a036431ec055e9107974a0ae4aef60c4532f0 | |
parent | 73e852eb074753a59507f1ef15061e6cb7d6ca9b (diff) |
resonance_audio: AlignedAllocator: fix C++20 build
C++17 deprecated, and C++20 removed, the nested pointer, size_type
etc. typedefs in std::allocator. Since C++11, the way to get these
types is to go via allocator_traits, so do that.
This breaks compatibility with C++ < 11.
Change-Id: I13dd257a372af50dd93a8aa8ea3a19b27bea0a5a
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
(cherry picked from commit 6018d96410753dd44dd310f1d45ad908d39f6cfe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/3rdparty/resonance-audio/patches/0001-resonance_audio-fix-C-20-build.patch | 36 | ||||
-rw-r--r-- | src/3rdparty/resonance-audio/resonance_audio/base/aligned_allocator.h | 6 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/3rdparty/resonance-audio/patches/0001-resonance_audio-fix-C-20-build.patch b/src/3rdparty/resonance-audio/patches/0001-resonance_audio-fix-C-20-build.patch new file mode 100644 index 000000000..2de42ad26 --- /dev/null +++ b/src/3rdparty/resonance-audio/patches/0001-resonance_audio-fix-C-20-build.patch @@ -0,0 +1,36 @@ +From f8c9ec7cfabb59977629f303edf7cf90ca8521d3 Mon Sep 17 00:00:00 2001 +From: Marc Mutz <marc.mutz@qt.io> +Date: Tue, 28 Jun 2022 19:38:13 +0200 +Subject: [PATCH] AlignedAllocator: fix C++20 build + +C++17 deprecated, and C++20 removed, the nested pointer, size_type +etc. typedefs in std::allocator. Since C++11, the way to get these +types is to go via allocator_traits, so do that. + +This breaks compatibility with C++ < 11. + +Fixes #61 +--- + .../resonance_audio/base/aligned_allocator.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/resonance_audio/base/aligned_allocator.h b/resonance_audio/base/aligned_allocator.h +index ac60e8292..628ccaa02 100644 +--- a/resonance_audio/base/aligned_allocator.h ++++ b/resonance_audio/base/aligned_allocator.h +@@ -72,9 +72,9 @@ void AllignedFree(PointerType mem_block_aligned) { + template <typename Type, size_t Alignment> + class AlignedAllocator : public std::allocator<Type> { + public: +- typedef typename std::allocator<Type>::pointer Pointer; +- typedef typename std::allocator<Type>::const_pointer ConstPointer; +- typedef typename std::allocator<Type>::size_type SizeType; ++ using Pointer = typename std::allocator_traits<std::allocator<Type>>::pointer; ++ using ConstPointer = typename std::allocator_traits<std::allocator<Type>>::const_pointer; ++ using SizeType = typename std::allocator_traits<std::allocator<Type>>::size_type; + + AlignedAllocator() { StaticAlignmentCheck<sizeof(Type), Alignment>(); } + +-- +2.25.1 + diff --git a/src/3rdparty/resonance-audio/resonance_audio/base/aligned_allocator.h b/src/3rdparty/resonance-audio/resonance_audio/base/aligned_allocator.h index ac60e8292..628ccaa02 100644 --- a/src/3rdparty/resonance-audio/resonance_audio/base/aligned_allocator.h +++ b/src/3rdparty/resonance-audio/resonance_audio/base/aligned_allocator.h @@ -72,9 +72,9 @@ void AllignedFree(PointerType mem_block_aligned) { template <typename Type, size_t Alignment> class AlignedAllocator : public std::allocator<Type> { public: - typedef typename std::allocator<Type>::pointer Pointer; - typedef typename std::allocator<Type>::const_pointer ConstPointer; - typedef typename std::allocator<Type>::size_type SizeType; + using Pointer = typename std::allocator_traits<std::allocator<Type>>::pointer; + using ConstPointer = typename std::allocator_traits<std::allocator<Type>>::const_pointer; + using SizeType = typename std::allocator_traits<std::allocator<Type>>::size_type; AlignedAllocator() { StaticAlignmentCheck<sizeof(Type), Alignment>(); } |