-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for absl::InlinedVector<T, N>? #3
Comments
Perhaps we can just use stl_bind directly? |
It's the first time I hear about High-level, here is what accumulated over all those years (to show that it's not a lot): And here is the implementation: |
Possibly. I don't know too much about the details of it. |
Confirmed that this works fine. Snippet: #include "pybind11/stl_bind.h"
#include "pybind11_abseil/absl_casters.h"
namespace py = ::pybind11;
PYBIND11_MAKE_OPAQUE(absl::InlinedVector<int, 4>);
namespace my_namespace {
namespace {
void applyBindings(pybind11::module_& m) {
py::bind_vector<absl::InlinedVector<int, 4>>(m, "InlinedVector_int_4");
}
} // namespace
} // namespace my_namespace a = InlinedVector_int_4()
a.append(6)
a.append(-5)
print(a)
b = InlinedVector_int_4([2, 5, -6)
print(b) I even tried this with |
Just a comment: |
Makes sense. This suffices for my use purpose (statically setting some values in a struct at startup). Mapping a Python tuple, list, or iterable to C++ would mean iterating over it and calling |
I have a function that returns
absl::InlinedVector<float, 4>
, as well as a struct that contains one as a member.I'm happy to implement this but would like to entertain suggestions for API design, especially for generic types
T
.The text was updated successfully, but these errors were encountered: