Error: no matching constructor for initialization of 'std::shared_ptr<uint8_t []>'
Error: no matching constructor for initialization of 'std::shared_ptr<uint8_t []>'
我试图在我的 NDK 应用程序中使用 std::shared_ptr <uint8_t []>
,但编译器抛出了以下错误。
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]);
我的 NDK 版本是 r19c,CMake 如下所示
cmake {
version "3.10.2"
cppFlags "-std=c++17 -stdlib=libc++ -frtti -fexceptions"
...
}
根据 libc++ Feature Test Macro Support page,__cpp_lib_shared_ptr_arrays
功能目前尚未实现。
可能与this task not having been started according to this page有关。
同时,另一种选择可能是显式指定数组删除器:
std::shared_ptr<uint8_t> x_data(new uint8_t[bytes_to_send], std::default_delete<uint8_t[]>());
(如文档中所示 here)
我试图在我的 NDK 应用程序中使用 std::shared_ptr <uint8_t []>
,但编译器抛出了以下错误。
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]);
我的 NDK 版本是 r19c,CMake 如下所示
cmake {
version "3.10.2"
cppFlags "-std=c++17 -stdlib=libc++ -frtti -fexceptions"
...
}
根据 libc++ Feature Test Macro Support page,__cpp_lib_shared_ptr_arrays
功能目前尚未实现。
可能与this task not having been started according to this page有关。
同时,另一种选择可能是显式指定数组删除器:
std::shared_ptr<uint8_t> x_data(new uint8_t[bytes_to_send], std::default_delete<uint8_t[]>());
(如文档中所示 here)