-
Notifications
You must be signed in to change notification settings - Fork 274
Add rvalue constructor to xmlt #3600
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,13 @@ class xmlt | |
typedef std::list<xmlt> elementst; | ||
typedef std::map<std::string, std::string> attributest; | ||
|
||
xmlt(std::string &&_name, attributest &&_attributes, elementst &&_elements) | ||
: name(std::move(_name)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should _name get a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering how well that would work given the common case is a C string at that point. Or maybe it actually makes no difference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. std::string has a lot of optimisation behind it (I've seen instances with copy-on-write, short-string stored in the class itself, etc.); however, disregarding this, yes, it should. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've now added the |
||
attributes(std::move(_attributes)), | ||
elements(std::move(_elements)) | ||
{ | ||
} | ||
|
||
std::string name, data; | ||
|
||
attributest attributes; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style