N
null hypothesis
Greetings,
Assuming that the APIs provide me with a way to
query to the length of the output string
before the actual copy request is made, I can either:
* allocate a buffer
* call API to copy data to a basic_string
* delete said buffer
* return basic_string
or:
* create a vector with a size argument
* copy data
* return basic string copying out the data
(the Meyer's solution)
Is there a way I can eliminate the final copying?
I would have liked to see basic_string with a move
constructor and a move enabled assign at the very least.
Or, is there a fundamental problem with the move
approach that I have overlooked?
Assuming that the APIs provide me with a way to
query to the length of the output string
before the actual copy request is made, I can either:
* allocate a buffer
* call API to copy data to a basic_string
* delete said buffer
* return basic_string
or:
* create a vector with a size argument
* copy data
* return basic string copying out the data
(the Meyer's solution)
Is there a way I can eliminate the final copying?
I would have liked to see basic_string with a move
constructor and a move enabled assign at the very least.
Or, is there a fundamental problem with the move
approach that I have overlooked?