vector-indexing-suite.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 CNRS
3 // Authors: Joseph Mirabel
4 //
5 //
6 // This file is part of hpp-python
7 // hpp-python is free software: you can redistribute it
8 // and/or modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation, either version
10 // 3 of the License, or (at your option) any later version.
11 //
12 // hpp-python is distributed in the hope that it will be
13 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Lesser Public License for more details. You should have
16 // received a copy of the GNU Lesser General Public License along with
17 // hpp-python If not, see
18 // <http://www.gnu.org/licenses/>.
19 
20 #ifndef PYHPP_VECTOR_INDEXING_SUITE_HH
21 #define PYHPP_VECTOR_INDEXING_SUITE_HH
22 
23 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
24 
25 namespace pyhpp {
26 template <class Container, bool NoProxy = false>
28  : public boost::python::vector_indexing_suite<
29  Container, NoProxy,
30  cpp_like_vector_indexing_suite<Container, NoProxy> > {
31  public:
32  typedef boost::python::vector_indexing_suite<Container, NoProxy,
35  template <class Class>
36  static void extension_def(Class& cl) {
37  base_type::extension_def(cl);
38 
39  cl.def("size", &base_type::size)
40  .def("empty", &empty)
41  .def("push_back", &base_type::append);
42  }
43 
44  static bool empty(Container const& container) { return container.empty(); }
45 };
46 } // namespace pyhpp
47 
48 #endif // PYHPP_VECTOR_INDEXING_SUITE_HH
Definition: vector-indexing-suite.hh:30
static void extension_def(Class &cl)
Definition: vector-indexing-suite.hh:36
boost::python::vector_indexing_suite< Container, NoProxy, cpp_like_vector_indexing_suite > base_type
Definition: vector-indexing-suite.hh:34
static bool empty(Container const &container)
Definition: vector-indexing-suite.hh:44
Definition: fwd.hh:25