dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.68k stars 322 forks source link

Add CxxVector::new for creating an empty vector #1262

Closed capickett closed 10 months ago

capickett commented 10 months ago

When constructing a CxxVector to pass to C++, you have to end up writing your own utility function that constructs a UniquePtr<CxxVector<...>> and add that to your projects cxx bridge. Creating an empty vector seems like a simple enough task to afford having an API for it on CxxVector.

capickett commented 10 months ago

Thanks, looks good so far. You'll also need some changes in gen/src/write.rs (this is why linking failed with MSVC in CI).

Thanks for the pointer!

dtolnay commented 10 months ago

Published in cxx 1.0.107.