mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08: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();
|
||||
|
||||
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);
|
||||
|
||||
@ -150,7 +150,7 @@ namespace Net
|
||||
};
|
||||
|
||||
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);
|
||||
connect(handler, &DownloadHandler::finished, context, slot);
|
||||
|
Loading…
Reference in New Issue
Block a user