Issue
I am trying to use std::shared_ptr <uint8_t []>
in my NDK application, but compiler throws below error.
error: no matching constructor for initialization of '
std::shared_ptr<uint8_t []>
'
std::shared_ptr<uint8_t[]> x_data(new uint8_t[bytes_to_send]);
My NDK version is r19c and the CMake looks like below
cmake {
version "3.10.2"
cppFlags "-std=c++17 -stdlib=libc++ -frtti -fexceptions"
...
}
Solution
According to the libc++ Feature Test Macro Support page, the __cpp_lib_shared_ptr_arrays
feature is currently unimplemented.
It may have something to do with this task not having been started according to this page.
An alternative in the meantime might be to explicitly specify an array deleter:
std::shared_ptr<uint8_t> x_data(new uint8_t[bytes_to_send], std::default_delete<uint8_t[]>());
(as seen in the documentation here)
Answered By - Michael
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.