MeshLib Python Docs
Loading...
Searching...
No Matches
Inheritance diagram for mrmeshpy.ConstChildren:

Public Member Functions

None __init__ (self, Const_std_vector_std_shared_ptr_Object children)
None __init__ (self, ConstConstChildren arg0)
Public Member Functions inherited from mrmeshpy.ConstConstChildren
ConstObject __getitem__ (self, int i)
 __init__ (self, *args, **kwargs)
typing.Iterator[ConstObject] __iter__ (self)
bool empty (self)
int size (self)

Static Public Member Functions

None __init__ (*args, **kwargs)

Additional Inherited Members

Static Public Attributes inherited from mrmeshpy.ConstConstChildren
 ConstStorage = Const_std_vector_std_shared_ptr_Object
 Storage = std_vector_std_shared_ptr_Object

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__() [1/3]

None mrmeshpy.ConstChildren.__init__ ( * args,
** kwargs )
static

◆ __init__() [2/3]

None mrmeshpy.ConstChildren.__init__ ( self,
Const_std_vector_std_shared_ptr_Object children )

◆ __init__() [3/3]

None mrmeshpy.ConstChildren.__init__ ( self,
ConstConstChildren arg0 )
Implicit copy constructor.

The documentation for this class was generated from the following file: