diff --git a/test/back_reference.cpp b/test/back_reference.cpp index d5ae5ece..73990640 100644 --- a/test/back_reference.cpp +++ b/test/back_reference.cpp @@ -93,12 +93,12 @@ BOOST_PYTHON_MODULE_INIT(back_reference_ext) def("copy_Z", copy_Z, return_value_policy()); def("x_instances", &X::count); - class_("Y", init()) + class_("Y", args()) .def("value", &Y::value) .def("set", &Y::set) ; - class_ >("Z", init()) + class_ >("Z", args()) .def("value", &Z::value) .def("set", &Z::set) ; diff --git a/test/bienstman3.cpp b/test/bienstman3.cpp index 22c7638e..f1dc212d 100644 --- a/test/bienstman3.cpp +++ b/test/bienstman3.cpp @@ -17,6 +17,6 @@ BOOST_PYTHON_MODULE_INIT(bienstman3_ext) using namespace boost::python; class_("V", no_init); - class_("B", init()); + class_("B", args()); } diff --git a/test/bienstman4.cpp b/test/bienstman4.cpp index ee510f2d..324af85a 100644 --- a/test/bienstman4.cpp +++ b/test/bienstman4.cpp @@ -30,7 +30,7 @@ BOOST_PYTHON_MODULE_INIT(bienstman4_ext) class_("T1") ; - class_("Term", init()) + class_("Term", args()) ; Type1 t1; diff --git a/test/bienstman5.cpp b/test/bienstman5.cpp index 75fbd8da..007d12a9 100644 --- a/test/bienstman5.cpp +++ b/test/bienstman5.cpp @@ -17,7 +17,7 @@ BOOST_PYTHON_MODULE_INIT(bienstman5_ext) { using namespace boost::python; - class_("M", init const&>()) + class_("M", args const&>()) ; } diff --git a/test/callbacks.cpp b/test/callbacks.cpp index 763dcda8..700c190a 100644 --- a/test/callbacks.cpp +++ b/test/callbacks.cpp @@ -137,8 +137,8 @@ BOOST_PYTHON_MODULE_INIT(callbacks_ext) def("apply_to_string_literal", apply_to_string_literal); - class_("X", init()) - .def(init()) + class_("X", args()) + .def_init(args()) .def("value", &X::value) .def("set", &X::set) ; diff --git a/test/data_members.cpp b/test/data_members.cpp index 7a05d359..99459dff 100644 --- a/test/data_members.cpp +++ b/test/data_members.cpp @@ -22,14 +22,14 @@ double get_fair_value(X const& x) { return x.value(); } BOOST_PYTHON_MODULE_INIT(data_members_ext) { - class_("X", init()) + class_("X", args()) .def("value", &X::value) .def("set", &X::set) .def_readonly("x", &X::x) .add_property("fair_value", &get_fair_value) ; - class_("Y", init()) + class_("Y", args()) .def("value", &Y::value) .def("set", &Y::set) .def_readwrite("x", &Y::x) diff --git a/test/defaults.cpp b/test/defaults.cpp index 41341e72..0f552666 100644 --- a/test/defaults.cpp +++ b/test/defaults.cpp @@ -158,17 +158,25 @@ BOOST_PYTHON_MODULE_INIT(defaults_ext) .def("barfoo", (object(*)(int, char, std::string, double))0, bar_stubs()) ; - class_("Y", init<>("doc of Y init")) // this should work + class_("Y", no_init) .def("get_state", &Y::get_state) ; class_("X") - .def(init >("doc of init")) - .def(init()[default_call_policies()]) // what's a good policy here? +# if (!defined(BOOST_INTEL_CXX_VERSION) || BOOST_INTEL_CXX_VERSION > 600) + .def(init >()) + .def(init()) +# else + .def_init(args()) + .def_init(args()) + .def_init(args()) + .def_init(args()) + .def_init(args()) +# endif .def("get_state", &X::get_state) .def("bar", &X::bar, X_bar_stubs()) - .def("bar2", &X::bar2, X_bar_stubs2("doc of X::bar2")[return_internal_reference<>()]) + .def("bar2", &X::bar2, X_bar_stubs2(), return_internal_reference<>()) .def("foo", (object(X::*)(std::string, bool) const)0, X_foo_2_stubs()) .def("foo", (object(X::*)(int, bool) const)0, X_foo_2_stubs()) .def("foo", (object(X::*)(list, list, bool) const)0, X_foo_3_stubs()) diff --git a/test/docstring.cpp b/test/docstring.cpp index 417a6635..01bacfba 100644 --- a/test/docstring.cpp +++ b/test/docstring.cpp @@ -36,24 +36,23 @@ BOOST_PYTHON_MODULE_INIT(docstring_ext) "A simple test module for documentation strings\n" "Exercised by docstring.py" ; - + class_("X", "A simple class wrapper around a C++ int\n" "includes some error-checking" - - , init( - "this is the __init__ function\n" - "its documentation has two lines." - ) + + , args(), + "this is the __init__ function\n" + "its documentation has two lines." ) .def("value", &X::value, "gets the value of the object") ; - + def("create", create, return_value_policy(), "creates a new X object"); - + def("fact", fact, "compute the factorial"); } diff --git a/test/extract.cpp b/test/extract.cpp index 749f265a..17640f2f 100644 --- a/test/extract.cpp +++ b/test/extract.cpp @@ -124,7 +124,7 @@ BOOST_PYTHON_MODULE_INIT(extract_ext) ; object x_class( - class_("X", init()) + class_("X", args()) .def( "__repr__", x_rep)); // Instantiate an X object through the Python interface diff --git a/test/implicit.cpp b/test/implicit.cpp index 2637f5ca..cbf34027 100644 --- a/test/implicit.cpp +++ b/test/implicit.cpp @@ -27,7 +27,7 @@ BOOST_PYTHON_MODULE_INIT(implicit_ext) def("x_value", x_value); def("make_x", make_x); - class_("X", init()) + class_("X", args()) .def("value", &X::value) .def("set", &X::set) ; diff --git a/test/list.cpp b/test/list.cpp index 83ea063b..b3bce4a2 100644 --- a/test/list.cpp +++ b/test/list.cpp @@ -138,7 +138,7 @@ BOOST_PYTHON_MODULE_INIT(list_ext) def("exercise", exercise); - class_("X", init()) + class_("X", args()) .def( "__repr__", x_rep) ; } diff --git a/test/m1.cpp b/test/m1.cpp index 434ab096..f09e4a93 100644 --- a/test/m1.cpp +++ b/test/m1.cpp @@ -259,8 +259,8 @@ BOOST_PYTHON_MODULE_INIT(m1) ; class_("complicated", - init()) - .def(init()) + args()) + .def_init(args()) .def("get_n", &complicated::get_n) ; } diff --git a/test/multi_arg_constructor.cpp b/test/multi_arg_constructor.cpp index 24bc4d9a..43e8bfb1 100644 --- a/test/multi_arg_constructor.cpp +++ b/test/multi_arg_constructor.cpp @@ -17,7 +17,7 @@ BOOST_PYTHON_MODULE_INIT(multi_arg_constructor_ext) class_ >( "A" - , init() + , args() ) ; diff --git a/test/nested.cpp b/test/nested.cpp index 8cbe3d79..9bc5be32 100644 --- a/test/nested.cpp +++ b/test/nested.cpp @@ -34,12 +34,12 @@ BOOST_PYTHON_MODULE_INIT(nested_ext) // Establish X as the current scope. scope x_class( - class_("X", init()) + class_("X", args()) .def(str(self)) ); // Y will now be defined in the current scope - class_("Y", init()) + class_("Y", args()) .def(str(self)) ; } diff --git a/test/operators.cpp b/test/operators.cpp index dc2313df..e21b5509 100755 --- a/test/operators.cpp +++ b/test/operators.cpp @@ -59,7 +59,7 @@ std::ostream& operator<<(std::ostream& s, X const& x) BOOST_PYTHON_MODULE_INIT(operators_ext) { - class_("X", init()) + class_("X", args()) .def("value", &X::value) .def(self - self) .def(self - int()) @@ -77,7 +77,7 @@ BOOST_PYTHON_MODULE_INIT(operators_ext) .def(pow(int(),self)) ; - class_ >("Z", init()) + class_ >("Z", args()) .def(int_(self)) .def(float_(self)) .def(complex_(self)) diff --git a/test/pickle1.cpp b/test/pickle1.cpp index 1f9e5139..e1397d60 100644 --- a/test/pickle1.cpp +++ b/test/pickle1.cpp @@ -48,7 +48,7 @@ namespace { BOOST_PYTHON_MODULE_INIT(pickle1_ext) { using namespace boost::python; - class_("world", init()) + class_("world", args()) .def("greet", &world::greet) .def_pickle(world_pickle_suite()) ; diff --git a/test/pickle2.cpp b/test/pickle2.cpp index b8aacbd7..984d6380 100644 --- a/test/pickle2.cpp +++ b/test/pickle2.cpp @@ -90,7 +90,7 @@ namespace { // Avoid cluttering the global namespace. BOOST_PYTHON_MODULE_INIT(pickle2_ext) { boost::python::class_( - "world", boost::python::init()) + "world", boost::python::args()) .def("greet", &world::greet) .def("get_secret_number", &world::get_secret_number) .def("set_secret_number", &world::set_secret_number) diff --git a/test/pickle3.cpp b/test/pickle3.cpp index 5fae9e6c..8911b24c 100644 --- a/test/pickle3.cpp +++ b/test/pickle3.cpp @@ -98,7 +98,7 @@ namespace { // Avoid cluttering the global namespace. BOOST_PYTHON_MODULE_INIT(pickle3_ext) { boost::python::class_( - "world", boost::python::init()) + "world", boost::python::args()) .def("greet", &world::greet) .def("get_secret_number", &world::get_secret_number) .def("set_secret_number", &world::set_secret_number) diff --git a/test/test_pointer_adoption.cpp b/test/test_pointer_adoption.cpp index 90b39ea7..b04e3496 100644 --- a/test/test_pointer_adoption.cpp +++ b/test/test_pointer_adoption.cpp @@ -26,7 +26,7 @@ struct inner { this->s = new_s; } - + std::string s; }; @@ -42,7 +42,7 @@ struct A : Base { ++a_instances; } - + ~A() { --a_instances; @@ -65,7 +65,7 @@ struct B { B() : x(0) {} B(A* x_) : x(x_) {} - + inner const* adopt(A* x) { this->x = x; return &x->get_inner(); } std::string a_content() @@ -96,29 +96,29 @@ BOOST_PYTHON_MODULE_INIT(test_pointer_adoption_ext) def("create", create, return_value_policy()); def("as_A", as_A, return_internal_reference<>()); - + class_("Base") ; - - class_ >("A", no_init) + + class_ >(no_init) .def("content", &A::content) .def("get_inner", &A::get_inner, return_internal_reference<>()) ; - - class_("inner", no_init) + + class_(no_init) .def("change", &inner::change) ; - + class_("B") - .def(init()[with_custodian_and_ward_postcall<1,2>()]) - + .def_init(args(), with_custodian_and_ward_postcall<1,2>()) + .def("adopt", &B::adopt // Adopt returns a pointer referring to a subobject of its 2nd argument (1st being "self") , return_internal_reference<2 // Meanwhile, self holds a reference to the 2nd argument. , with_custodian_and_ward<1,2> >() ) - + .def("a_content", &B::a_content) ; } diff --git a/test/virtual_functions.cpp b/test/virtual_functions.cpp index f0bfd787..73d47dc5 100644 --- a/test/virtual_functions.cpp +++ b/test/virtual_functions.cpp @@ -89,7 +89,7 @@ int X::counter; BOOST_PYTHON_MODULE_INIT(virtual_functions_ext) { - class_("concrete", init()) + class_("concrete", args()) .def("value", &concrete::value) .def("set", &concrete::set) .def("call_f", &concrete::call_f) @@ -97,14 +97,14 @@ BOOST_PYTHON_MODULE_INIT(virtual_functions_ext) ; class_ - >("abstract", init()) + >("abstract", args()) .def("value", &abstract::value) .def("call_f", &abstract::call_f) .def("set", &abstract::set) ; - class_("Y", init()) + class_("Y", args()) .def("value", &Y::value) .def("set", &Y::set) ;