You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so did you spot that the 3rd parameter is set to "true", with no name?
this works as expected:
ofParameter<bool> color_ { "color", false };
it's because the single-arg template passes the arg as the init value, and not name except for the void versions and somehow C++ considers a non-null char * as "true" (albeit with a warning if the implicit conversions are required which is not the default.
question for a template nerd: without changing the general rules (it's OK that by default a single-arg param is prioritized about the value) would it be possible to "catch" that the implicit conversion of char * value for a <bool> parameter should be prohibited so we get an error? like passing a single string to other types:
(implicit conversions activated; otherwise it silently compiles, and it may take a while to figure out why the entry in ofxPanel is an empty rectangle...)
The text was updated successfully, but these errors were encountered:
using the constructors of ofParameter in .h is great. however it's easy to slip in an error:
so did you spot that the 3rd parameter is set to "true", with no name?
this works as expected:
it's because the single-arg template passes the arg as the init value, and not name except for the
void
versions and somehow C++ considers a non-null char * as "true" (albeit with a warning if the implicit conversions are required which is not the default.question for a template nerd: without changing the general rules (it's OK that by default a single-arg param is prioritized about the value) would it be possible to "catch" that the implicit conversion of char * value for a
<bool>
parameter should be prohibited so we get an error? like passing a single string to other types:(implicit conversions activated; otherwise it silently compiles, and it may take a while to figure out why the entry in ofxPanel is an empty rectangle...)
The text was updated successfully, but these errors were encountered: