diff --git a/src/bindings/eina_cxx/eina_optional.hh b/src/bindings/eina_cxx/eina_optional.hh index 2517412ebf..64e42d7d8d 100644 --- a/src/bindings/eina_cxx/eina_optional.hh +++ b/src/bindings/eina_cxx/eina_optional.hh @@ -4,6 +4,7 @@ #include #include #include +#include /** * @addtogroup Eina_Cxx_Data_Types_Group @@ -86,7 +87,7 @@ struct optional */ optional(T&& other) : engaged(false) { - _construct(std::move(other)); + _construct(std::forward(other)); } /** @@ -99,7 +100,35 @@ struct optional */ optional(T const& other) : engaged(false) { - _construct(std::move(other)); + _construct(other); + } + + /** + * @brief Create an engaged object by moving @p other content. + * @param other R-value reference to the desired type. + * + * This constructor creates an eina::optional object in an + * engaged state. The contained value is initialized by moving + * @p other. + */ + template + optional(U&& other, typename std::enable_if::value>::type* = 0) : engaged(false) + { + _construct(std::forward(other)); + } + + /** + * @brief Create an engaged object by copying @p other content. + * @param other Constant reference to the desired type. + * + * This constructor creates an eina::optional object in an + * engaged state. The contained value is initialized by copying + * @p other. + */ + template + optional(U const& other, typename std::enable_if::value>::type* = 0) : engaged(false) + { + _construct(other); } /**