Public Member Functions | |
| ConstObject | __getitem__ (self, int i) |
| __init__ (self, *args, **kwargs) | |
| typing.Iterator[ConstObject] | __iter__ (self) |
| bool | empty (self) |
| int | size (self) |
Static Public Attributes | |
| ConstStorage = Const_std_vector_std_shared_ptr_Object | |
| Storage = std_vector_std_shared_ptr_Object | |
Generated from: MR::ConstChildren
read-only access to the children of an Object, as returned by Object::constChildren()
Object stores its children as std::shared_ptr<Object>, and a const Object cannot hand
them out directly without either dropping constness or copying the whole vector.
This class solves that: it is a lightweight non-owning view on the object's children,
which produces std::shared_ptr<const Object> on the fly. Typical use:
for ( const auto & child : obj.constChildren() )
processRecursively( *child );
It is also indexable, so a plain loop works too:
for ( size_t i = 0; i < obj.constChildren().size(); ++i )
process( *obj.constChildren()[i] );
The view refers to the object's own storage, so use it as a temporary and do not store
it: it is invalidated by anything that adds, removes or reorders the object's children,
exactly like an iterator of the underlying vector.
| mrmeshpy.ConstConstChildren.__init__ | ( | self, | |
| * | args, | ||
| ** | kwargs ) |
__init__(*args, **kwargs) Overloaded function. 1. __init__(self: meshlib.mrmeshpy.ConstConstChildren, children: meshlib.mrmeshpy.Const_std_vector_std_shared_ptr_Object) -> None 2. __init__(self: meshlib.mrmeshpy.ConstConstChildren, arg0: meshlib.mrmeshpy.ConstConstChildren) -> None Implicit copy constructor. 3. __init__(self: meshlib.mrmeshpy.ConstConstChildren, : meshlib.mrmeshpy.ConstConstChildren) -> None
| ConstObject mrmeshpy.ConstConstChildren.__getitem__ | ( | self, | |
| int | i ) |
| typing.Iterator[ConstObject] mrmeshpy.ConstConstChildren.__iter__ | ( | self | ) |
| bool mrmeshpy.ConstConstChildren.empty | ( | self | ) |
| int mrmeshpy.ConstConstChildren.size | ( | self | ) |
|
static |
|
static |