From d65936200a2756e6619a109fa6fa673b91df802e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 26 Jun 2018 22:25:22 +0200 Subject: modernize C++ syntax No visible changes (hopefully). --- options/connector.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'options/connector.cpp') diff --git a/options/connector.cpp b/options/connector.cpp index 6031d9ed..2d039ccf 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -27,7 +27,7 @@ bool connector::is_equal(const QString& name, const QVariant& val1, const QVaria auto it = connected_values.find(name); - if (it != connected_values.cend() && std::get<0>((*it).second).size() != 0) + if (it != connected_values.cend() && !std::get<0>((*it).second).empty()) return std::get<1>((*it).second)(val1, val2); else return generic_is_equal(val1, val2); @@ -37,29 +37,23 @@ bool connector::on_value_destructed_impl(const QString& name, value_type val) { QMutexLocker l(get_mtx()); - const bool ok = progn( - auto it = connected_values.find(name); + auto it = connected_values.find(name); - if (it != connected_values.end()) + if (it != connected_values.end()) + { + std::vector& values = std::get<0>((*it).second); + for (auto it = values.begin(); it != values.end(); it++) { - std::vector& values = std::get<0>((*it).second); - for (auto it = values.begin(); it != values.end(); it++) + if (*it == val) { - if (*it == val) - { - values.erase(it); - return true; - } + values.erase(it); + return true; } } - return false; - ); - - return ok; + } + return false; } - - void connector::on_value_destructed(const QString& name, value_type val) { if (!name.size()) -- cgit v1.2.3