File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ protected:
37
37
public:
38
38
Flags (const bool &b = false );
39
39
Flags (const char *flags);
40
- Flags (std::vector<bool > & &flags);
40
+ Flags (const std::vector<bool > &flags);
41
41
42
42
void add (const bool &b);
43
43
Original file line number Diff line number Diff line change @@ -50,7 +50,16 @@ BOOST_PYTHON_MODULE(wrap)
50
50
using dgs::Flags;
51
51
bp::class_<Flags>(" Flags" , bp::init<>())
52
52
.def (bp::init<const char *>())
53
- // TODO .def(bp::init<std::vector<bool>&& >())
53
+ .def (" __init__" , bp::make_constructor (+[](bp::list bools) {
54
+ std::vector<bool > flags (bp::len (bools));
55
+ for (std::size_t i = 0 ; i < flags.size (); ++i) flags[i] = bp::extract<bool >(bools[i]);
56
+ return new Flags (flags);
57
+ }))
58
+ .def (" __init__" , bp::make_constructor (+[](bp::tuple bools) {
59
+ std::vector<bool > flags (bp::len (bools));
60
+ for (std::size_t i = 0 ; i < flags.size (); ++i) flags[i] = bp::extract<bool >(bools[i]);
61
+ return new Flags (flags);
62
+ }))
54
63
.def (" add" , &Flags::add)
55
64
.def (" set" , &Flags::set)
56
65
.def (" unset" , &Flags::unset)
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Flags::Flags(const char *_flags)
47
47
}
48
48
}
49
49
50
- Flags::Flags (std::vector<bool > & &_flags)
50
+ Flags::Flags (const std::vector<bool > &_flags)
51
51
: flags(_flags), outOfRangeFlag(false ) {}
52
52
53
53
Flags::operator bool (void ) const {
You can’t perform that action at this time.
0 commit comments