Browse Source

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.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
0891cd4878
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/net/downloadmanager.h

4
src/base/net/downloadmanager.h

@ -119,7 +119,7 @@ namespace Net @@ -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 @@ -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…
Cancel
Save