mdds
Loading...
Searching...
No Matches
mdds::mtv::position_hint Struct Reference

#include <types.hpp>

Public Member Functions

template<detail::has_position_hint_data Iter>
 position_hint (const Iter &it) noexcept

Public Attributes

container_id_t container_id = 0
std::size_t block_index = 0

Detailed Description

Hint used in multi_type_vector to speed up block position lookup. It stores the identifier of the container instance it originates from, and the index of a block to start the lookup from.

A default-constructed instance represents "no hint", and any hint value is safe to pass to any container instance; a hint that does not originate from the receiving container simply gets ignored, and the lookup falls back to an unhinted search.

An instance of this type is implicitly constructible from an iterator or a const iterator of multi_type_vector, which enables the common feed-back pattern of storing the iterator return value of a mutator method as a hint for the next call.

Constructor & Destructor Documentation

◆ position_hint()

template<detail::has_position_hint_data Iter>
mdds::mtv::position_hint::position_hint ( const Iter & it)
inlinenoexcept

Implicitly construct a hint from a block iterator of multi_type_vector. Only the container identity and the block index stored in the iterator get copied; the resulting hint carries no pointers into the container.