diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/parser/cpdf_array.h | 33 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.h | 12 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_indirect_object_holder.h | 12 |
3 files changed, 33 insertions, 24 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h index 125cb4cbf8..0b16f7f21b 100644 --- a/core/fpdfapi/parser/cpdf_array.h +++ b/core/fpdfapi/parser/cpdf_array.h @@ -10,6 +10,7 @@ #include <memory> #include <set> #include <type_traits> +#include <utility> #include <vector> #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" @@ -58,39 +59,43 @@ class CPDF_Array : public CPDF_Object { // a ByteStringPool. template <typename T, typename... Args> typename std::enable_if<!CanInternStrings<T>::value, T*>::type AddNew( - Args... args) { - return static_cast<T*>(Add(pdfium::MakeUnique<T>(args...))); + Args&&... args) { + return static_cast<T*>( + Add(pdfium::MakeUnique<T>(std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<CanInternStrings<T>::value, T*>::type AddNew( - Args... args) { - return static_cast<T*>(Add(pdfium::MakeUnique<T>(m_pPool, args...))); + Args&&... args) { + return static_cast<T*>( + Add(pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<!CanInternStrings<T>::value, T*>::type SetNewAt( size_t index, - Args... args) { - return static_cast<T*>(SetAt(index, pdfium::MakeUnique<T>(args...))); + Args&&... args) { + return static_cast<T*>( + SetAt(index, pdfium::MakeUnique<T>(std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<CanInternStrings<T>::value, T*>::type SetNewAt( size_t index, - Args... args) { - return static_cast<T*>( - SetAt(index, pdfium::MakeUnique<T>(m_pPool, args...))); + Args&&... args) { + return static_cast<T*>(SetAt( + index, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<!CanInternStrings<T>::value, T*>::type InsertNewAt( size_t index, - Args... args) { - return static_cast<T*>(InsertAt(index, pdfium::MakeUnique<T>(args...))); + Args&&... args) { + return static_cast<T*>( + InsertAt(index, pdfium::MakeUnique<T>(std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<CanInternStrings<T>::value, T*>::type InsertNewAt( size_t index, - Args... args) { - return static_cast<T*>( - InsertAt(index, pdfium::MakeUnique<T>(m_pPool, args...))); + Args&&... args) { + return static_cast<T*>(InsertAt( + index, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...))); } void RemoveAt(size_t index, size_t nCount = 1); 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. diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h index a78e6663b3..1b174d8b62 100644 --- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h +++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h @@ -10,6 +10,7 @@ #include <map> #include <memory> #include <type_traits> +#include <utility> #include "core/fpdfapi/parser/cpdf_object.h" #include "core/fxcrt/cfx_string_pool_template.h" @@ -34,14 +35,15 @@ class CPDF_IndirectObjectHolder { // handle objects that can intern strings from our ByteStringPool. template <typename T, typename... Args> typename std::enable_if<!CanInternStrings<T>::value, T*>::type NewIndirect( - Args... args) { - return static_cast<T*>(AddIndirectObject(pdfium::MakeUnique<T>(args...))); + Args&&... args) { + return static_cast<T*>( + AddIndirectObject(pdfium::MakeUnique<T>(std::forward<Args>(args)...))); } template <typename T, typename... Args> typename std::enable_if<CanInternStrings<T>::value, T*>::type NewIndirect( - Args... args) { - return static_cast<T*>( - AddIndirectObject(pdfium::MakeUnique<T>(m_pByteStringPool, args...))); + Args&&... args) { + return static_cast<T*>(AddIndirectObject( + pdfium::MakeUnique<T>(m_pByteStringPool, std::forward<Args>(args)...))); } // Takes ownership of |pObj|, returns unowned pointer to it. |