diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index b6979d73..3ac27e06 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -179,10 +179,10 @@ public: #endif std::optional get() const; - template - T get(const T &defaultValue) const + template + T get(U &&defaultValue) const { - return get().value_or(defaultValue); + return get().value_or(std::forward(defaultValue)); } #ifndef __DOXYGEN__ diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index aac9a2bd..b68a44c1 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -104,7 +104,7 @@ std::size_t YamlObject::size() const */ /** - * \fn template YamlObject::get(const T &defaultValue) const + * \fn template YamlObject::get(U &&defaultValue) const * \brief Parse the YamlObject as a \a T value * \param[in] defaultValue The default value when failing to parse *