-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Currently implicit inserts in json_array and json_object wrap the inserted type, whether json_element, dynamic_string or some primitive type in another json_element as
insert(json_element(forward<val_t>(val)));Firstly, this is redundant when inserting json_element but I also suspect that, for other types, this introduces one unnecessary move/copy operation, that is, (assuming val_t is not `json_element)
- The value is moved/copied into a
json_elementrvalue instance - That
json_elementis then moved intopairinstance - Upon insertion, the said
json_elementis moved into the container
If we could open up the container machinery we could cut out the middle step and move/copy the value directly into the container.
This applies for object insert, insert_or_assign, and array push_back, push_front, insert etc.
Metadata
Metadata
Assignees
Labels
No labels