Lets say I have a function to get data into an std vector:
void getData(std::vector &toBeFilled) {
// Push data into \"toBeFilled\"
}
No.
The API you're using has a contract that states it takes ownership of the data you provide it, and that this data is provided through a pointer. This basically rules out using standard vectors.
Vector will always assuredly free the memory it allocated and safely destroy the elements it contains. That is part of its guaranteed contract and you cannot turn that off.
You have to make a copy of the data if you wish to take ownership of them... or move each element out into your own container. Or start with your own new[]
in the first place (ugh) though you can at least wrap all this in some class that mimics std::vector
and becomes non-owning.