Reputation: 7891
You may know that you can create a QByteArray
from a raw pointer, using one of its constructors, or QByteArray::fromRawData. The former will deep copy the raw pointer so you have to pay the cost, but the later will just use the pointer. None of them takes ownership of the pointer. Is there any other method to create a QByteArray from a raw pointer, which not only takes ownership of the pointer but also doesn't deep copy the pointer?
Upvotes: 2
Views: 308
Reputation: 3911
No, there is no way to pass the ownership to the QByteArray
. This would require the class to support a custom cleanup handler just like the QScopedPointer
.
Upvotes: 2