-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add std::optional-like return for your attribute-getters #22
Comments
I'm generally in favor of an optional-like interface. Also I'm not sure if it makes sense to go with a custom wrapper - I would rather use std::optional if it's available... Of course this would mean that "attribute does not exist" and "there was an error parsing it" would be conflated. |
i would use std::optional (if available) only internaly in the xml_value - the big benefit is getting rid of the default-value AND have the valid-info - maybe serveral versions of converters needed? int get_int(int default); // your current |
To me, the operator bool is perfectly fine To retreive values I would like to see an enhancement to xml_text similar to this instead template and //! @return Whether conversion to T was successful or similar that would make life easier when using pugixml for generic serialization etc |
its still a huge difference if there is a attribute with valid or invalid content or complete absent of the attribute itself
The text was updated successfully, but these errors were encountered: