From 4e137d5cbb85c0344f4135ba6dc39bbf57f90e41 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Tue, 10 Mar 2020 12:28:52 +0000 Subject: Avoid using 'boost::aligned_storage' which is known to be problematic in MSVC builds:- https://www.boost.org/doc/libs/1_65_0/libs/type_traits/doc/html/boost_typetraits/reference/aligned_storage.html --- libs/ardour/ardour/chan_mapping.h | 11 +++++++++++ libs/ardour/ardour/plugin_insert.h | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index cc42ed01bc..7a4d41123e 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -104,8 +104,19 @@ public: */ bool is_subset (const ChanMapping& superset) const; +#if defined(_MSC_VER) && (_MSC_VER < 1900) + /* Use the older (heap based) mapping for early versions of MSVC. + * In fact it might be safer to use this for all MSVC builds - as + * our StackAllocator class depends on 'boost::aligned_storage' + * which is known to be troublesome with Visual C++ :- + * https://www.boost.org/doc/libs/1_65_0/libs/type_traits/doc/html/boost_typetraits/reference/aligned_storage.html + */ + typedef std::map TypeMapping; + typedef std::map Mappings; +#else typedef std::map, PBD::StackAllocator, 16> > TypeMapping; typedef std::map, PBD::StackAllocator, 2> > Mappings; +#endif Mappings mappings() { return _mappings; } const Mappings& mappings() const { return _mappings; } diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 003df28a38..3beaef9a15 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -371,7 +371,17 @@ private: /* ordered map [plugin instance ID] => ARDOUR::ChanMapping * TODO: consider replacing with boost::flat_map<> or std::vector<>. */ - class PinMappings : public std::map , PBD::StackAllocator, 4> > +#if defined(_MSC_VER) && (_MSC_VER < 1900) + /* Use the older (heap based) mapping for early versions of MSVC. + * In fact it might be safer to use this for all MSVC builds - as + * our StackAllocator class depends on 'boost::aligned_storage' + * which is known to be troublesome with Visual C++ :- + * https://www.boost.org/doc/libs/1_65_0/libs/type_traits/doc/html/boost_typetraits/reference/aligned_storage.html + */ + class PinMappings : public std::map +#else + class PinMappings : public std::map , PBD::StackAllocator, 4> > +#endif { public: /* this emulates C++11's std::map::at() -- cgit v1.2.3