X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.h;h=cead16fadc0d5dafd56fa416ef467442bbf8d3e6;hp=63d724c996008712a0e53931d15a4175ad7d721b;hb=42ab7cc22c4702716db2b8bfa1d4545169f772e6;hpb=a0e333e994dce2d949a84930293382020e724596 diff --git a/src/common/util.h b/src/common/util.h index 63d724c9..cead16fa 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -105,3 +105,27 @@ COMMON_EXPORT QString tryFormatUnixEpoch(const QString &possibleEpochDate, * @return Date/time in ISO 8601 format with timezone offset */ COMMON_EXPORT QString formatDateTimeToOffsetISO(const QDateTime &dateTime); + +namespace detail { + +template +struct SelectOverloadHelper +{ + template + constexpr auto operator()(R(C::*func)(Args...)) const noexcept -> decltype(func) { return func; } +}; + +} // detail + +/** + * Helper for resolving ambiguous overloads when using the member function-based connect syntax. + * + * Example usage: + * @code + * connect(this, selectOverload(&MyClass::mySignal), other, &Other::mySlot); + * @endcode + * + * @tparam Args Argument types of the desired signature + */ +template +constexpr Q_DECL_UNUSED detail::SelectOverloadHelper selectOverload = {};