-
Notifications
You must be signed in to change notification settings - Fork 727
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 overloads with size_t type argument #537
Conversation
stefanroellin
commented
Dec 3, 2022
- bool xml_attribute::set_name(const char_t* rhs, size_t sz)
- xml_attribute xml_node::append_attribute(const char_t* name_, size_t sz)
- xml_node xml_node::append_child(const char_t* name_, size_t sz)
- xml_attribute xml_node::attribute(const char_t* name_, size_t sz) const
- xml_node xml_node::child(const char_t* name_, size_t sz) const
- bool xml_node::set_name(const char_t* rhs, size_t sz)
What's the motivation for these? The change that added |
I work a lot with std::string_view. Since the current interface mostly works with zero-terminated strings, it is not possible to use a std::string_view, since it is not necessarily zero-terminated. Adding the above overloads allows me to use std::string_view. |
I would be willing to merge a subset of this that only introduces set_name. The other additions can be replicated externally without allocations - it’s not always ideal, in particular append_attribute would need to be called with “” followed by set_name - but it’s clean and orthogonal. Let me know if you’d like to rebase the PR with that subset. |
Oh also ideally these should be added to docs/manual.adoc although I can do this myself; I can also reduce the PR to a mergeable state myself in a few days if that’s ok. |
I can rebase the branch and add some documentation. Just to be sure: you will accept a pull request with the following two enhancements:
|
Yup exactly. Thanks! |
* bool xml_attribute::set_name(const char_t* rhs, size_t sz) * bool xml_node::set_name(const char_t* rhs, size_t sz)
11d5044
to
f4d4316
Compare
Branch rebased such that only the two methods
are included. Also added the methods to the documentation. |
Thanks! |