// Module test_vector_shared_ext.cpp // // Copyright (c) 2003 Raoul M. Gough // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy // at http://www.boost.org/LICENSE_1_0.txt) // // History // ======= // 2003/10/15 rmg File creation from test_vector_ext.cpp // // $Id$ // #include "int_wrapper.hpp" #include #include #include #include #include #include #include #include #include #include // More messiness from not having a separate int_wrapper.cpp file bool int_wrapper::our_trace_flag = true; unsigned int_wrapper::our_object_counter = 0; BOOST_TT_BROKEN_COMPILER_SPEC (boost::shared_ptr) BOOST_PYTHON_MODULE(test_vector_shared_ext) { namespace indexing = boost::python::indexing; typedef boost::shared_ptr int_wrapper_holder; typedef std::vector Container1; boost::python::implicitly_convertible (); boost::python::def ("setTrace", &int_wrapper::setTrace); boost::python::class_ ("int_wrapper", boost::python::init()) .def ("increment", &int_wrapper::increment) .def ("__repr__", &int_wrapper::repr) .def ("__cmp__", compare) ; #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) // Partial specialization of value_traits takes care of things // automatically typedef indexing::container_suite Suite1; #else // Otherwise do it the hard way typedef indexing::indirect_value_traits value_traits_; typedef indexing::default_sequence_traits container_traits_; typedef indexing::default_algorithms algorithms_; typedef indexing::container_suite Suite1; #endif boost::python::class_("Vector_shared") .def (Suite1()) .def ("reserve", &Container1::reserve) ; }