diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-03 05:08:57 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-03 05:08:57 +0200 |
commit | f1f0c43eeecef064719d72b398d245db12d6afe6 (patch) | |
tree | f6899ee06304a22da2b9ded380754f512fde6a2a | |
parent | ba131466002b656a3e65685ac08a13dadc69aa99 (diff) |
logic/shortcuts: destructure binding; avoid capture
wrt capture:
If a lambda-expression [...] captures a structured
binding (explicitly or implicitly), the program is
ill-formed.
-- P0588R1, Core issue 2313
Also it's unnecessary to make the removed lambda.
-rw-r--r-- | logic/shortcuts.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/logic/shortcuts.cpp b/logic/shortcuts.cpp index 478036a2..f03c8973 100644 --- a/logic/shortcuts.cpp +++ b/logic/shortcuts.cpp @@ -127,17 +127,14 @@ void Shortcuts::reload(const t_keys& keys_) for (unsigned i = 0; i < sz; i++) { - const auto& kk = keys_[i]; - const key_opts& opts = std::get<0>(kk); - const bool held = std::get<2>(kk); - auto const& fun = std::get<1>(kk); + auto const& [opts, fun, held] = keys_[i]; #ifdef _WIN32 K k; #else K k(nullptr); #endif bind_shortcut(k, opts, held); - keys.emplace_back(k, [=](bool flag) { fun(flag); }, held); + keys.emplace_back(k, fun, held); #ifndef _WIN32 const int idx = keys.size() - 1; |