Regina 7.3 Calculation Engine
Public Member Functions | Friends | List of all members
regina::MarkedElement Class Reference

A base class for elements of MarkedVector. More...

#include <utilities/markedvector.h>

Inheritance diagram for regina::MarkedElement:
regina::detail::ComponentBase< 2 > regina::detail::ComponentBase< 3 > regina::detail::ComponentBase< 4 > regina::detail::FaceBase< 3, 0 > regina::detail::FaceBase< 3, 1 > regina::detail::FaceBase< 3, 2 > regina::detail::FaceBase< 4, 0 > regina::detail::FaceBase< 4, 1 > regina::detail::FaceBase< 4, 2 > regina::detail::FaceBase< 4, 3 > regina::detail::SimplexBase< 2 > regina::detail::SimplexBase< 3 > regina::detail::SimplexBase< 4 > regina::Crossing regina::ModelLinkGraphNode regina::detail::BoundaryComponentBase< dim > regina::detail::ComponentBase< dim > regina::detail::FaceBase< dim, subdim > regina::detail::SimplexBase< dim >

Public Member Functions

size_t markedIndex () const
 Returns the index at which this object is stored in an MarkedVector. More...
 

Friends

template<typename T >
class MarkedVector
 Allow only MarkedVector to edit the array index. More...
 

Detailed Description

A base class for elements of MarkedVector.

MarkedVector is a vector class that provides fast, space-efficient reverse lookup of array indices (i.e., given an object, find the index at which it is stored). The way it does this is to store the array indices in the object themselves.

As a result, any type to be stored in a MarkedVector must be derived from this class. This class provides a space to store the corresponding array index, and looks after access control so that only MarkedVector can edit this index.

Since indices are stored with the objects, it is possible to perform this reverse lookup by querying the object alone, without any reference to the actual vector. This can be done through the public routine markedIndex().

The trade-off of course is that any object may not belong to more than one MarkedVector at a time. Any attempt to do this will result in undefined behaviour.

See MarkedVector for further information.

Python
Not present.

Member Function Documentation

◆ markedIndex()

size_t regina::MarkedElement::markedIndex ( ) const
inline

Returns the index at which this object is stored in an MarkedVector.

If this object does not belong to an MarkedVector, the return value is undefined.

Returns
the index at which this object is stored.

Friends And Related Function Documentation

◆ MarkedVector

template<typename T >
friend class MarkedVector
friend

Allow only MarkedVector to edit the array index.


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

Copyright © 1999-2023, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).