diff --git a/include/pybind11/stl_bind.h b/include/pybind11/stl_bind.h index 2cf303ad8..37839826d 100644 --- a/include/pybind11/stl_bind.h +++ b/include/pybind11/stl_bind.h @@ -108,7 +108,7 @@ void vector_if_equal_operator(Class_ &cl) { ); } -template auto vector_if_insertion_operator(Class_ &cl, const char *name) +template auto vector_if_insertion_operator(Class_ &cl, std::string const &name) -> decltype(std::declval() << std::declval(), void()) { using size_type = typename Vector::size_type; @@ -132,12 +132,12 @@ NAMESPACE_END(detail) template , typename holder_type = std::unique_ptr>, typename... Args> -pybind11::class_, holder_type> bind_vector(pybind11::module &m, const char *name, Args&&... args) { +pybind11::class_, holder_type> bind_vector(pybind11::module &m, std::string const &name, Args&&... args) { using Vector = std::vector; using SizeType = typename Vector::size_type; using Class_ = pybind11::class_; - Class_ cl(m, name, std::forward(args)...); + Class_ cl(m, name.c_str(), std::forward(args)...); cl.def(pybind11::init<>());