diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-26 06:21:07 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-10-26 06:55:33 +0200 |
commit | 4b8ffd3f999e2b8ac9f431fbd9b1235527762d7a (patch) | |
tree | cc8a47b956d66153c03035fd581ef4c57fad353f /compat | |
parent | f332f55a59d5cfbe24927f4543442e449cc5a999 (diff) |
compat/util: move stuff around
Diffstat (limited to 'compat')
-rw-r--r-- | compat/util.hpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/compat/util.hpp b/compat/util.hpp index f9e9dea9..80ab4270 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -15,13 +15,11 @@ template<typename t> using mem = std::shared_ptr<t>; template<typename t> using ptr = std::unique_ptr<t>; -template<typename F> -void run_in_thread_async(QObject* obj, F&& fun) -{ - QObject src; - src.moveToThread(obj->thread()); - QObject::connect(&src, &QObject::destroyed, obj, std::move(fun), Qt::AutoConnection); -} +#if defined(_MSC_VER) && !defined(Q_CREATOR_RUN) +# define DEFUN_WARN_UNUSED _Check_return_ +#else +# define DEFUN_WARN_UNUSED __attribute__((warn_unused_result)) +#endif namespace detail { @@ -113,8 +111,11 @@ auto run_in_thread_sync(QObject* obj, F&& fun) return traits::pass(std::move(ret)); } -#if defined(_MSC_VER) && !defined(Q_CREATOR_RUN) -# define DEFUN_WARN_UNUSED _Check_return_ -#else -# define DEFUN_WARN_UNUSED __attribute__((warn_unused_result)) -#endif +template<typename F> +void run_in_thread_async(QObject* obj, F&& fun) +{ + QObject src; + src.moveToThread(obj->thread()); + QObject::connect(&src, &QObject::destroyed, obj, std::move(fun), Qt::AutoConnection); +} + |