Access Python blueprints with bounds checking
This commit is contained in:
parent
a1158c6ca8
commit
60d866d5b6
|
@ -47,6 +47,10 @@ namespace client {
|
|||
return _blueprints[pos];
|
||||
}
|
||||
|
||||
const_reference at(size_type pos) const {
|
||||
return _blueprints.at(pos);
|
||||
}
|
||||
|
||||
const_iterator begin() const /*noexcept*/ {
|
||||
return _blueprints.begin();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void export_blueprint() {
|
|||
class_<cc::BlueprintLibrary, boost::noncopyable, boost::shared_ptr<cc::BlueprintLibrary>>("BlueprintLibrary", no_init)
|
||||
.def("filter", &cc::BlueprintLibrary::Filter)
|
||||
.def("__getitem__", +[](const cc::BlueprintLibrary &self, size_t pos) -> cc::ActorBlueprint {
|
||||
return self[pos];
|
||||
return self.at(pos);
|
||||
})
|
||||
.def("__len__", &cc::BlueprintLibrary::size)
|
||||
.def("__iter__", range(&cc::BlueprintLibrary::begin, &cc::BlueprintLibrary::end))
|
||||
|
|
Loading…
Reference in New Issue