mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 05:25:37 +00:00
Avoid unecessary copying the parameter
Using forwarding reference here so that we won't get unnecessary copies of the parameter passed to `slot`, for example a lambda function.
This commit is contained in:
parent
aeabd2d625
commit
0891cd4878
@ -119,7 +119,7 @@ namespace Net
|
|||||||
static DownloadManager *instance();
|
static DownloadManager *instance();
|
||||||
|
|
||||||
template <typename Context, typename Func>
|
template <typename Context, typename Func>
|
||||||
void download(const DownloadRequest &downloadRequest, Context context, Func slot);
|
void download(const DownloadRequest &downloadRequest, Context context, Func &&slot);
|
||||||
|
|
||||||
void registerSequentialService(const ServiceID &serviceID);
|
void registerSequentialService(const ServiceID &serviceID);
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ namespace Net
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Context, typename Func>
|
template <typename Context, typename Func>
|
||||||
void DownloadManager::download(const DownloadRequest &downloadRequest, Context context, Func slot)
|
void DownloadManager::download(const DownloadRequest &downloadRequest, Context context, Func &&slot)
|
||||||
{
|
{
|
||||||
const DownloadHandler *handler = download(downloadRequest);
|
const DownloadHandler *handler = download(downloadRequest);
|
||||||
connect(handler, &DownloadHandler::finished, context, slot);
|
connect(handler, &DownloadHandler::finished, context, slot);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user