Commit 90a84519 authored by Igor Kushnir's avatar Igor Kushnir
Browse files

ScopedDialog: forward arguments to the dialog's constructor

This change improves performance by doing less copying during
construction. In addition the forwarding allows to pass non-copyable
objects by reference.
parent 8e0cf453
......@@ -9,6 +9,8 @@
#include <QPointer>
#include <utility>
namespace KDevelop {
/**
......@@ -44,7 +46,8 @@ public:
/// Construct the dialog with any set of allowed arguments
/// for the construction of DialogType
template<typename ... Arguments>
explicit ScopedDialog(Arguments ... args) : ptr(new DialogType(args ...))
explicit ScopedDialog(Arguments&& ... args)
: ptr{new DialogType(std::forward<Arguments>(args)...)}
{
}
/// Automatically deletes the dialog if it is still present
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment