stl-pair.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_STD_PAIR_HH
21 #define PYHPP_STD_PAIR_HH
22 
23 #include <boost/python.hpp>
24 
25 namespace pyhpp {
26 template <typename T1, typename T2>
27 struct stl_pair {
28  typedef std::pair<T1, T2> pair_type;
29 
30  stl_pair(const char* name) {
31  using namespace boost::python;
32  class_<pair_type>(name, init<>())
33  .def(init<const T1&, const T2&>())
34  .def_readwrite("first", &pair_type::first)
35  .def_readwrite("second", &pair_type::second);
36  }
37 };
38 } // namespace pyhpp
39 
40 #endif // PYHPP_STD_PAIR_HH
Definition: fwd.hh:25
Definition: stl-pair.hh:27
std::pair< T1, T2 > pair_type
Definition: stl-pair.hh:28
stl_pair(const char *name)
Definition: stl-pair.hh:30