Merge branch 'stl_bind'
diff --git a/example/example17.cpp b/example/example17.cpp
index 8790234..8ae4cad 100644
--- a/example/example17.cpp
+++ b/example/example17.cpp
@@ -28,7 +28,7 @@
pybind11::class_<El>(m, "El")
.def(pybind11::init<int>());
- pybind11::bind_vector<int>(m, "VectorInt");
+ pybind11::bind_vector<unsigned int>(m, "VectorInt");
pybind11::bind_vector<El>(m, "VectorEl");
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index 85e3792..abbf479 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -25,6 +25,8 @@
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+# pragma GCC diagnostic ignored "-Wstrict-aliasing"
+# pragma GCC diagnostic ignored "-Wattributes"
#endif
#include "attr.h"
@@ -209,7 +211,7 @@
rec->signature = strdup(signature.c_str());
rec->args.shrink_to_fit();
- rec->is_constructor = !strcmp(rec->name, "__init__");
+ rec->is_constructor = !strcmp(rec->name, "__init__") || !strcmp(rec->name, "__setstate__");
rec->has_args = false;
rec->has_kwargs = false;
rec->nargs = (uint16_t) args;
diff --git a/include/pybind11/stl_bind.h b/include/pybind11/stl_bind.h
index e27dcfd..2cf303a 100644
--- a/include/pybind11/stl_bind.h
+++ b/include/pybind11/stl_bind.h
@@ -141,8 +141,15 @@
cl.def(pybind11::init<>());
+ // Register copy constructor (if possible)
detail::vector_if_copy_constructible<Vector, Class_>(cl);
+ // Register comparison-related operators and functions (if possible)
+ detail::vector_if_equal_operator<Vector, Class_>(cl);
+
+ // Register stream insertion operator (if possible)
+ detail::vector_if_insertion_operator<Vector, Class_>(cl, name);
+
cl.def("__init__", [](Vector &v, iterable it) {
new (&v) Vector();
try {
@@ -154,7 +161,6 @@
throw;
}
});
-
cl.def("append", (void (Vector::*) (const T &)) & Vector::push_back,
arg("x"),
"Add an item to the end of the list");
@@ -297,12 +303,6 @@
"Delete list elements using a slice object"
);
- // Comparisons
- detail::vector_if_equal_operator<Vector, Class_>(cl);
-
- // Printing
- detail::vector_if_insertion_operator<Vector, Class_>(cl, name);
-
#if 0
// C++ style functions deprecated, leaving it here as an example
cl.def(pybind11::init<size_type>());