MeshLib Rust Docs
Loading...
Searching...
No Matches
meshlib::ConstChildren Struct Reference
Inheritance diagram for meshlib::ConstChildren:

Public Member Functions

auto begin () const -> meshlib::Owned< meshlib::ConstChildren_Iterator >
auto end () const -> meshlib::Owned< meshlib::ConstChildren_Iterator >
auto empty () const -> bool
auto size () const -> usize
auto index (i:usize) const -> meshlib::Owned< meshlib::std_shared_ptr_const_MR_Object >

Static Public Member Functions

static auto construct_from_another (_other:&meshlib::ConstChildren) -> meshlib::Owned< meshlib::ConstChildren >
static auto construct (children:&meshlib::std_vector_std_shared_ptr_MR_Object) -> meshlib::Owned< meshlib::ConstChildren >
Static Public Member Functions inherited from meshlib::CppClass
static void destroy (ptr:*mut Self)
Static Public Member Functions inherited from meshlib::CppCopy
static auto copy (ptr:*const Self) -> *mut Self

Detailed Description

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. Generated from class MR::ConstChildren.

Generated from class MR::ConstChildren. Heap-allocated instances are held in Owned<ConstChildren>.

Member Function Documentation

◆ begin()

auto meshlib::ConstChildren::begin ( ) const -> meshlib::Owned< meshlib::ConstChildren_Iterator >

Generated from method MR::ConstChildren::begin.

Calls MR_ConstChildren_begin(). The reference to this object might be preserved in the return value.

◆ construct()

auto meshlib::ConstChildren::construct ( children:&meshlib::std_vector_std_shared_ptr_MR_Object ) -> meshlib::Owned< meshlib::ConstChildren >
static

Generated from constructor MR::ConstChildren::ConstChildren.

Calls MR_ConstChildren_Construct(). The reference to the parameter children might be preserved in the constructed object.

◆ construct_from_another()

auto meshlib::ConstChildren::construct_from_another ( _other:&meshlib::ConstChildren ) -> meshlib::Owned< meshlib::ConstChildren >
static

Generated from constructor MR::ConstChildren::ConstChildren.

Calls MR_ConstChildren_ConstructFromAnother(). The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object.

◆ empty()

auto meshlib::ConstChildren::empty ( ) const -> bool

Generated from method MR::ConstChildren::empty.

Calls MR_ConstChildren_empty().

◆ end()

auto meshlib::ConstChildren::end ( ) const -> meshlib::Owned< meshlib::ConstChildren_Iterator >

Generated from method MR::ConstChildren::end.

Calls MR_ConstChildren_end(). The reference to this object might be preserved in the return value.

◆ index()

auto meshlib::ConstChildren::index ( i:usize ) const -> meshlib::Owned< meshlib::std_shared_ptr_const_MR_Object >

Generated from method MR::ConstChildren::operator[].

Calls MR_ConstChildren_index().

◆ size()

auto meshlib::ConstChildren::size ( ) const -> usize

Generated from method MR::ConstChildren::size.

Calls MR_ConstChildren_size().


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