You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
register_vector and register_map with raw pointer #21768
Up to emscripten 3.1.53 I could register a std::map or std::vector that contained a raw pointer. The methods that returned these vectors and maps are marked with allow_raw_pointers().
However, starting from version 3.1.54 this code no longer works, getting this error:
static_assert(!std::is_pointer<T*>::value, "Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>>");
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| /emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:1889:94: note: in instantiation of template class 'emscripten::internal::TypeID<MyObject*>' requested here
| 1889 | internal::_embind_register_optional(internal::TypeID<std::optional<T>>::get(), internal::TypeID<T>::get());
| | ^
| /emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:1943:5: note: in instantiation of function template specialization 'emscripten::register_optional<MyObject*>' requested here
| 1943 | register_optional<T>();
How can I fix it? There's no way to add allow_raw_pointers() to register_vector or register_map. I've checked the documentation and I haven't seen any change that avoids registering maps or vectors with raw pointers.
Thanks!
Versions used:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.56 (cf90417346b78455089e64eb909d71d091ecc055)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 34ba90745fa55777436a2429a51a3799c83c6d4c)
Activity
[embind] Allow optional types to contain pointers.
[embind] Allow optional types to contain pointers.
[embind] Allow optional types to contain pointers. (#21769)
germanmarques commentedon Apr 18, 2024
Thanks!