summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJohn Emmas <john@creativepost.co.uk>2020-03-10 12:28:52 +0000
committerJohn Emmas <john@creativepost.co.uk>2020-03-10 12:28:52 +0000
commit4e137d5cbb85c0344f4135ba6dc39bbf57f90e41 (patch)
treeb9b77bb9dec4d2a2e62ea67fb29814eeca35cdaf /libs
parent9ef5f4d1598d726d5b8380d91af2e546fd1cb2d1 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/chan_mapping.h11
-rw-r--r--libs/ardour/ardour/plugin_insert.h12
2 files changed, 22 insertions, 1 deletions
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<uint32_t, uint32_t> TypeMapping;
+ typedef std::map<DataType, TypeMapping> Mappings;
+#else
typedef std::map<uint32_t, uint32_t, std::less<uint32_t>, PBD::StackAllocator<std::pair<const uint32_t, uint32_t>, 16> > TypeMapping;
typedef std::map<DataType, TypeMapping, std::less<DataType>, PBD::StackAllocator<std::pair<const DataType, TypeMapping>, 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 <uint32_t, ARDOUR::ChanMapping, std::less<uint32_t>, PBD::StackAllocator<std::pair<const uint32_t, ARDOUR::ChanMapping>, 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 <uint32_t, ARDOUR::ChanMapping>
+#else
+ class PinMappings : public std::map <uint32_t, ARDOUR::ChanMapping, std::less<uint32_t>, PBD::StackAllocator<std::pair<const uint32_t, ARDOUR::ChanMapping>, 4> >
+#endif
{
public:
/* this emulates C++11's std::map::at()