43 explicit ScopeGuard(std::function<
void() > onScopeExit) { m_onScopeExit = onScopeExit; }
47 void dismiss() { m_invoke =
false; };
49 std::function<void()> m_onScopeExit;
53#define SCOPEGUARD_LINENAME_CAT(name, line) name##line
54#define SCOPEGUARD_LINENAME(name, line) SCOPEGUARD_LINENAME_CAT(name, line)
56#define OnScopeExit( callback ) ScopeGuard SCOPEGUARD_LINENAME( myScopeGuard, __LINE__ ) ( [&] { callback; } );
58template <
typename Container,
typename Pred>
59Container filter(
const Container& container, Pred predicate) {
61 std::copy_if(container.begin(), container.end(), std::back_inserter(result), predicate);
68quint64 imageSize(
const QImage&);