summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/plugin_insert.h
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-11-04 15:37:46 +0100
committerRobin Gareus <robin@gareus.org>2018-11-04 15:37:46 +0100
commit8a4518d76fe78e5fb99900ff5ff71a22e5912395 (patch)
tree129208dc52c4f47e439b19574705771812387f6e /libs/ardour/ardour/plugin_insert.h
parentc9bf89392fc1aefabaedc95b9e7b513338154207 (diff)
Remove C++11'ism
While gnu-gcc had `std::map:at const` as non-standard extension it is n/a for older gcc on OSX. Surprisingly this const& p() const; performs a tad better as well, likely due to different exception handling. Perhaps it is also worth investigating boost::flat_map<> as replacement for std::map<>, here. Our common case is just a single entry, so using a std::vector emulated mapping might help.
Diffstat (limited to 'libs/ardour/ardour/plugin_insert.h')
-rw-r--r--libs/ardour/ardour/plugin_insert.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 0a56373972..5460e25a14 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -367,7 +367,24 @@ private:
/** details of the match currently being used */
Match _match;
- typedef std::map <uint32_t, ARDOUR::ChanMapping> PinMappings;
+ /* 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> {
+ public:
+ /* this emulates C++11's std::map::at()
+ * return mapping for given plugin instance */
+ inline ARDOUR::ChanMapping const& p (const uint32_t i) const {
+#ifndef NDEBUG
+ const_iterator x = find (i);
+ assert (x != end ());
+ return x->second;
+#else
+ return find(i)->second;
+#endif
+ }
+ };
+
PinMappings _in_map;
PinMappings _out_map;
ChanMapping _thru_map; // out-idx <= in-idx