aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-13 23:17:06 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-13 23:17:06 +0200
commit2d3590dbdb23c82f1960327ffbd78e778231b9c8 (patch)
tree34cb5b07e712403aed2f9b5f2aaebb0efa53e25b
parentd27d2ab396f92b7d5139f43afe52be6e0470eaea (diff)
downloadlibquotient-2d3590dbdb23c82f1960327ffbd78e778231b9c8.tar.gz
libquotient-2d3590dbdb23c82f1960327ffbd78e778231b9c8.zip
Pass universal references in Connection::callApi<>; fixed a typo in util.h
So that even uncopyable types could be used for parameters; also fixed a typo in util.h that prevented dispatch() from using with multiple argument functions.
-rw-r--r--connection.h4
-rw-r--r--util.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/connection.h b/connection.h
index 213bf26f..dbb50b9a 100644
--- a/connection.h
+++ b/connection.h
@@ -144,9 +144,9 @@ namespace QMatrixClient
* argument - callApi() will pass it automatically.
*/
template <typename JobT, typename... JobArgTs>
- JobT* callApi(JobArgTs... jobArgs) const
+ JobT* callApi(JobArgTs&&... jobArgs) const
{
- auto job = new JobT(jobArgs...);
+ auto job = new JobT(std::forward<JobArgTs>(jobArgs)...);
job->start(connectionData());
return job;
}
diff --git a/util.h b/util.h
index 1f9e3f0b..0c8f3640 100644
--- a/util.h
+++ b/util.h
@@ -231,7 +231,7 @@ namespace QMatrixClient
template <typename ResultT, typename... ArgTs>
Dispatch<ResultT, ArgTs...> dispatch(ArgTs&& ... args)
{
- return Dispatch<ResultT, ArgTs...>(std::forward<ArgTs...>(args)...);
+ return Dispatch<ResultT, ArgTs...>(std::forward<ArgTs>(args)...);
}
// The below enables pretty-printing of enums in logs