Reputation: 159
Recently I wrote a c++ code and I used a function from an external library. the type of one of the arguments of this function is std::vector, but my data is in a variable named payload, which it's type is const uint8_t*. so I copied my payload data into a vector with std::copy like below:
std::vector my_vector; std::copy(payload, payload + length, back_inserter(my_vector));
because of calling so much of this code, I'm in search for a lower cost operation to copy my payload data into my_vector variable in order to prepare input argument of the function which I used in my code. is there any way to this purpose?
Upvotes: 0
Views: 43