From 3b9ddc0f75634d57376ffa0517af5bed713ae403 Mon Sep 17 00:00:00 2001 From: pateldeev Date: Sun, 9 Aug 2026 17:50:37 -0700 Subject: [PATCH] Support type casting of InlinedVector --- pybind11_abseil/BUILD | 1 + pybind11_abseil/absl_casters.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pybind11_abseil/BUILD b/pybind11_abseil/BUILD index 9f073e1..f67fbcc 100644 --- a/pybind11_abseil/BUILD +++ b/pybind11_abseil/BUILD @@ -15,6 +15,7 @@ pybind_library( "@com_google_absl//absl/container:btree", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/container:inlined_vector", "@com_google_absl//absl/container:node_hash_map", "@com_google_absl//absl/container:node_hash_set", "@com_google_absl//absl/strings", diff --git a/pybind11_abseil/absl_casters.h b/pybind11_abseil/absl_casters.h index e021d79..6887840 100644 --- a/pybind11_abseil/absl_casters.h +++ b/pybind11_abseil/absl_casters.h @@ -22,6 +22,7 @@ // - absl::flat_hash_map- converts to/from python dict. // - absl::flat_hash_set- converst to/from python set. // - absl::btree_map- converts to/from python dict. +// - absl::InlinedVector- converts to/from python list. // // For details, see the README.md. // @@ -51,6 +52,7 @@ #include "absl/container/btree_map.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/container/inlined_vector.h" #include "absl/container/node_hash_map.h" #include "absl/container/node_hash_set.h" #include "absl/strings/cord.h" @@ -598,6 +600,11 @@ template struct type_caster> : set_caster, Key> {}; +// Convert between absl::InlinedVector and python list. +template +struct type_caster> + : list_caster, T> {}; + // Convert between absl::string_view and python. // // pybind11 supports std::string_view, and absl::string_view is meant to be a