diff options
author | tsepez <tsepez@chromium.org> | 2016-11-20 01:00:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-20 01:00:29 -0800 |
commit | d8f710cedd62c1d28beee15d7dc3d31ddd148437 (patch) | |
tree | 9ed21a220915236b2b85791ce5f25abd9a33c94e /core/fpdfapi/parser/cpdf_dictionary.h | |
parent | 3c3094d92e67264d8bdfcac2d8451364e73b0c82 (diff) | |
download | pdfium-d8f710cedd62c1d28beee15d7dc3d31ddd148437.tar.xz |
Provide perfect-forwarding in CPDF_Object templates.
We'll hit this issue when we try to make CPDF_stream ctors take other
unique pointers, for example.
Review-Url: https://codereview.chromium.org/2513613003
Diffstat (limited to 'core/fpdfapi/parser/cpdf_dictionary.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index 5d333808b9..13cbdcf7ac 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -10,6 +10,7 @@ #include <map> #include <memory> #include <set> +#include <utility> #include "core/fpdfapi/parser/cpdf_object.h" #include "core/fxcrt/cfx_string_pool_template.h" @@ -70,15 +71,16 @@ class CPDF_Dictionary : public CPDF_Object { template <typename T, typename... Args> typename std::enable_if<!CanInternStrings<T>::value, T*>::type SetNewFor( const CFX_ByteString& key, - Args... args) { - return static_cast<T*>(SetFor(key, pdfium::MakeUnique<T>(args...))); + Args&&... args) { + return static_cast<T*>( + SetFor(key, pdfium::MakeUnique<T>(std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<CanInternStrings<T>::value, T*>::type SetNewFor( const CFX_ByteString& key, - Args... args) { - return static_cast<T*>( - SetFor(key, pdfium::MakeUnique<T>(m_pPool, args...))); + Args&&... args) { + return static_cast<T*>(SetFor( + key, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...))); } // Convenience functions to convert native objects to array form. |