From a75d35bbb06f74e58cb2232d4ca2ce47950f08cd Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Fri, 10 Dec 2021 22:07:20 -0800
Subject: Use a vector in BFormatDec instead of FlexArray

FlexArray would be better since it's not likely to use much memory for the
array, but the std::unique_ptr makes BFormatDec a non-standard layout, causing
GCC and Clang to complain.
---
 core/bformatdec.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'core/bformatdec.h')

diff --git a/core/bformatdec.h b/core/bformatdec.h
index 2cc057f4..0231da1e 100644
--- a/core/bformatdec.h
+++ b/core/bformatdec.h
@@ -11,6 +11,7 @@
 #include "bufferline.h"
 #include "devformat.h"
 #include "filters/splitter.h"
+#include "vector.h"
 
 struct FrontStablizer;
 
@@ -37,13 +38,18 @@ class BFormatDec {
     const std::unique_ptr<FrontStablizer> mStablizer;
     const bool mDualBand{false};
 
-    al::FlexArray<ChannelDecoder> mChannelDec;
+    /* TODO: This should ideally be a FlexArray, since ChannelDecoder is rather
+     * small and only a few are needed (3, 4, 5, 7, typically). But that can
+     * only be used in a standard layout struct, and a std::unique_ptr member
+     * (mStablizer) causes GCC and Clang to warn it's not.
+     */
+    al::vector<ChannelDecoder> mChannelDec;
 
+public:
     BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs,
         const al::span<const ChannelDec> coeffslf, const float xover_f0norm,
         std::unique_ptr<FrontStablizer> stablizer);
 
-public:
     bool hasStablizer() const noexcept { return mStablizer != nullptr; };
 
     /* Decodes the ambisonic input to the given output channels. */
@@ -59,7 +65,7 @@ public:
         const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf,
         const float xover_f0norm, std::unique_ptr<FrontStablizer> stablizer);
 
-    DEF_FAM_NEWDEL(BFormatDec, mChannelDec)
+    DEF_NEWDEL(BFormatDec)
 };
 
 #endif /* CORE_BFORMATDEC_H */
-- 
cgit v1.2.3