From 8340be48084fd8a37ba8eebbab8f5afcc9bc7113 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 31 Jul 2023 13:35:37 -0600 Subject: [PATCH] add another version of FooListToControlList --- libs/ardour/ardour/utils.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 4c14e9d67e..e549d81862 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -126,8 +126,19 @@ template std::shared_ptr route_list_to_control_list (st template std::shared_ptr stripable_list_to_control_list (StripableList& sl, std::shared_ptr (Stripable::*get_control)() const) { std::shared_ptr cl (new ControlList); - for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) { - std::shared_ptr ac = ((*s).get()->*get_control)(); + for (auto const & s : sl) { + std::shared_ptr ac = (s.get()->*get_control)(); + if (ac) { + cl->push_back (ac); + } + } + return cl; +} + +template std::shared_ptr stripable_list_to_control_list (std::shared_ptr sl, std::shared_ptr (Stripable::*get_control)() const) { + std::shared_ptr cl (new ControlList); + for (auto const & s : *sl) { + std::shared_ptr ac = (s.get()->*get_control)(); if (ac) { cl->push_back (ac); }