diff --git a/libs/openFrameworks/types/ofParameter.h b/libs/openFrameworks/types/ofParameter.h index a51ffccf875..5d094aff539 100644 --- a/libs/openFrameworks/types/ofParameter.h +++ b/libs/openFrameworks/types/ofParameter.h @@ -514,16 +514,24 @@ class ofParameter : public ofAbstractParameter { /// \brief constructs an ofParameter of type ParameterType initialized to value of v /// where v is convertible to ParameterType, with an exception for bool which can cause - /// unexpected behavious (as string and char arrays are convertible to bool) + /// unexpected behavious (as string and char arrays are convertible to bool) and + /// the exception of a single string-convertible argument with std::string ParameterType /// \tparam ParameterType the type of the value held by the ofParameter /// \tparam Arg a type convertible to ParameterType /// \param v the value to initialize to template < typename Arg, - typename = std::enable_if_t<(std::is_convertible_v and + typename = std::enable_if_t<(!(std::is_convertible_v and std::is_same_v) and + std::is_convertible_v and !((std::is_same_v)and!(std::is_arithmetic_v)))>> ofParameter(const Arg & v); + /// \brief constructs an ofParameter initialized to value of v + /// \tparam ParameterType the type of the value held by the ofParameter + /// \param v the string value to initialize to + template >> + ofParameter(const std::string & v); + /// \brief constructs a named ofParameter of type ParameterType initialized to value of v /// \tparam ParameterType the type of the value held by the ofParameter /// \param name name of the parameter @@ -724,6 +732,12 @@ ofParameter::ofParameter(const Arg & v) : obj(std::make_shared(v)) , setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)) { } +template +template +ofParameter::ofParameter(const std::string & v) + : obj(std::make_shared(v)) + , setMethod(std::bind(&ofParameter::eventsSetValue, this, std::placeholders::_1)) { } + template ofParameter::ofParameter(const std::string & name, const ParameterType & v) : obj(std::make_shared(name, v))