@@ -514,16 +514,24 @@ class ofParameter : public ofAbstractParameter {
514
514
515
515
// / \brief constructs an ofParameter of type ParameterType initialized to value of v
516
516
// / where v is convertible to ParameterType, with an exception for bool which can cause
517
- // / unexpected behavious (as string and char arrays are convertible to bool)
517
+ // / unexpected behavious (as string and char arrays are convertible to bool) and
518
+ // / the exception of a single string-convertible argument with std::string ParameterType
518
519
// / \tparam ParameterType the type of the value held by the ofParameter
519
520
// / \tparam Arg a type convertible to ParameterType
520
521
// / \param v the value to initialize to
521
522
template <
522
523
typename Arg,
523
- typename = std::enable_if_t <(std::is_convertible_v<Arg, ParameterType> and
524
+ typename = std::enable_if_t <(!(std::is_convertible_v<Arg, std::string> and std::is_same_v<ParameterType, std::string>) and
525
+ std::is_convertible_v<Arg, ParameterType> and
524
526
!((std::is_same_v<ParameterType, bool >)and !(std::is_arithmetic_v<Arg>)))>>
525
527
ofParameter (const Arg & v);
526
528
529
+ // / \brief constructs an ofParameter<std::string> initialized to value of v
530
+ // / \tparam ParameterType the type of the value held by the ofParameter
531
+ // / \param v the string value to initialize to
532
+ template <typename U = ParameterType, typename = std::enable_if_t <std::is_same_v<U, std::string>>>
533
+ ofParameter (const std::string & v);
534
+
527
535
// / \brief constructs a named ofParameter of type ParameterType initialized to value of v
528
536
// / \tparam ParameterType the type of the value held by the ofParameter
529
537
// / \param name name of the parameter
@@ -724,6 +732,12 @@ ofParameter<ParameterType>::ofParameter(const Arg & v)
724
732
: obj(std::make_shared<Value>(v))
725
733
, setMethod(std::bind(&ofParameter<ParameterType>::eventsSetValue, this , std::placeholders::_1)) { }
726
734
735
+ template <typename ParameterType>
736
+ template <typename U, typename >
737
+ ofParameter<ParameterType>::ofParameter(const std::string & v)
738
+ : obj(std::make_shared<Value>(v))
739
+ , setMethod(std::bind(&ofParameter<std::string>::eventsSetValue, this , std::placeholders::_1)) { }
740
+
727
741
template <typename ParameterType>
728
742
ofParameter<ParameterType>::ofParameter(const std::string & name, const ParameterType & v)
729
743
: obj(std::make_shared<Value>(name, v))
0 commit comments