35 #ifndef LVR2_ATTRMAPS_STABLEVECTOR_H_ 36 #define LVR2_ATTRMAPS_STABLEVECTOR_H_ 40 #include <boost/optional.hpp> 41 #include <boost/shared_array.hpp> 60 template<
typename HandleT,
typename ElemT>
103 template<
typename HandleT,
typename ElemT>
108 "HandleT must inherit from BaseHandle!" 130 StableVector(
size_t countElements,
const boost::shared_array<ElementType>& sharedArray);
195 boost::optional<ElementType&>
get(
HandleType handle);
203 boost::optional<const ElementType&>
get(
HandleType handle)
const;
249 size_t numUsed()
const;
274 void reserve(
size_t newCap);
292 #include "lvr2/attrmaps/StableVector.tcc" StableVectorIterator & operator++()
HandleT operator*() const
A vector which guarantees stable indices and features O(1) deletion.
size_t m_pos
Current position in the vector.
bool operator==(const StableVectorIterator &other) const
size_t m_usedCount
Count of used elements in elements vector.
vector< boost::optional< ElementType > > m_elements
Vector for stored elements.
StableVector()
Creates an empty StableVector.
Iterator over handles in this vector, which skips deleted elements.
StableVectorIterator & operator=(const StableVectorIterator &other)
StableVectorIterator(const vector< boost::optional< ElemT >> *deleted, bool startAtEnd=false)
Handle to access Cluster of the ClusterBiMap.
bool operator!=(const StableVectorIterator &other) const
Represents a group of handles, which are somehow connected.
const vector< boost::optional< ElemT > > * m_elements
Reference to the deleted marker array this iterator belongs to.