I have a library function that requires an array of four pointers as parameter: f(unsigned char* data[4]), and I have an array of smart pointers in my code: std::unique_ptr<unsigned char> myArray[4].
Is there a way to use the smart pointers with this library function ?
I have already tried this but it gives me a segfault: f(reinterpret_cast<unsigned char **>(myArray[0].get()));
std::array<unsigned char* , 4> arr = { myArray[0].get(),myArray[1].get(),myArray[2].get(),myArray[3].get() };
pass arr.data().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With