Improve vacpp support.
[boost.git] / boost / libs / python / test / pointer_vector.cpp
blobc1f7dbd4ece744fc0aed35d6359c6ccfe2b65f69
1 // Copyright Joel de Guzman 2005-2006. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #include <boost/python.hpp>
5 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
6 #include <vector>
8 using namespace boost::python;
10 class Abstract
12 public:
13 virtual std::string f() =0;
16 class Concrete1 : public Abstract
18 public:
19 virtual std::string f() { return "harru"; }
22 typedef std::vector<Abstract*> ListOfObjects;
24 class DoesSomething
26 public:
27 DoesSomething() {}
29 ListOfObjects returnList()
31 ListOfObjects lst;
32 lst.push_back(new Concrete1()); return lst;
36 BOOST_PYTHON_MODULE(pointer_vector_ext)
38 class_<Abstract, boost::noncopyable>("Abstract", no_init)
39 .def("f", &Abstract::f)
42 class_<ListOfObjects>("ListOfObjects")
43 .def( vector_indexing_suite<ListOfObjects>() )
46 class_<DoesSomething>("DoesSomething")
47 .def("returnList", &DoesSomething::returnList)