Use fold expressions (C++17 feature)

This commit is contained in:
Mat Sutcliffe
2021-04-16 21:33:27 +01:00
parent 7955d0a06e
commit b75e3859d4
3 changed files with 4 additions and 14 deletions

View File

@@ -165,13 +165,8 @@ namespace BlackMisc
template <typename T, typename F, size_t... Is>
void tupleForEachPairImpl(T &&tuple, F &&visitor, std::index_sequence<Is...>)
{
// parameter pack swallow idiom
static_cast<void>(std::initializer_list<int>
{
//! \fixme C-style cast is needed due to a clang bug: https://bugs.llvm.org/show_bug.cgi?id=39375
// cppcheck-suppress accessForwarded
((void)(std::forward<F>(visitor)(std::get<Is * 2>(std::forward<T>(tuple)), std::get<Is * 2 + 1>(std::forward<T>(tuple)))), 0)...
});
// cppcheck-suppress accessForwarded
(static_cast<void>(std::forward<F>(visitor)(std::get<Is * 2>(std::forward<T>(tuple)), std::get<Is * 2 + 1>(std::forward<T>(tuple)))), ...);
}
}