Skip to main content

eosio::multi_index::index

More...

Public Classes

Name
structconst_iterator

Public Types

Name
enumconstants { table_name = static_cast<uint64_t>(TableName), index_name = static_cast<uint64_t>(IndexName), index_number = Number, index_table_name = (static_cast<uint64_t>(TableName) & 0xFFFFFFFFFFFFFFF0ULL)
(Number & 0x000000000000000FULL)}
typedef Extractorsecondary_extractor_type
typedef std::decay< decltype(Extractor()(nullptr))>::typesecondary_key_type
typedef std::reverse_iterator< const_iterator >const_reverse_iterator
struct multi_index::index::const_iterator

Public Functions

Name
constexpr static boolvalidate_index_name(eosio::name n)
constexpr static uint64_tname()
constexpr static uint64_tnumber()
autoextract_secondary_key(const T & obj)
const_iteratorcbegin() const
const_iteratorbegin() const
const_iteratorcend() const
const_iteratorend() const
const_reverse_iteratorcrbegin() const
const_reverse_iteratorrbegin() const
const_reverse_iteratorcrend() const
const_reverse_iteratorrend() const
const_iteratorfind(secondary_key_type && secondary) const
const_iteratorfind(const secondary_key_type & secondary) const
const_iteratorrequire_find(secondary_key_type && secondary, const char * error_msg ="unable to findsecondary key") const
const_iteratorrequire_find(const secondary_key_type & secondary, const char * error_msg ="unable to findsecondary key") const
const T &get(secondary_key_type && secondary, const char * error_msg ="unable to findsecondary key") const
const T &get(const secondary_key_type & secondary, const char * error_msg ="unable to findsecondary key") const
const_iteratorlower_bound(secondary_key_type && secondary) const
const_iteratorlower_bound(const secondary_key_type & secondary) const
const_iteratorupper_bound(secondary_key_type && secondary) const
const_iteratorupper_bound(const secondary_key_type & secondary) const
const_iteratoriterator_to(const T & obj)
template <typename Lambda >
void
modify(const_iterator itr, eosio::name payer, Lambda && updater)
template <typename Lambda >
void
modify(const T & obj, eosio::name payer, Lambda && updater)
const_iteratorerase(const_iterator itr)
eosio::nameget_code() const
uint64_tget_scope() const

Friends

Name
classmulti_index

Detailed Description

template <name::raw IndexName,
typename Extractor ,
uint64_t Number,
bool IsConst>
struct eosio::multi_index::index;

Public Types Documentation

enum constants

EnumeratorValueDescription
table_namestatic_cast<uint64_t>(TableName)
index_namestatic_cast<uint64_t>(IndexName)
index_numberNumber
index_table_name(static_cast<uint64_t>(TableName) & 0xFFFFFFFFFFFFFFF0ULL)
(Number & 0x000000000000000FULL)

typedef secondary_extractor_type

typedef Extractor eosio::multi_index< TableName, T, Indices >::index< IndexName, Extractor, Number, IsConst >::secondary_extractor_type;

typedef secondary_key_type

typedef std::decay<decltype( Extractor()(nullptr) )>::type eosio::multi_index< TableName, T, Indices >::index< IndexName, Extractor, Number, IsConst >::secondary_key_type;

typedef const_reverse_iterator

typedef std::reverse_iterator<const_iterator> eosio::multi_index< TableName, T, Indices >::index< IndexName, Extractor, Number, IsConst >::const_reverse_iterator;

struct multi_index::index::const_iterator

Public Functions Documentation

function validate_index_name

static inline constexpr static bool validate_index_name(
eosio::name n
)

function name

static inline constexpr static uint64_t name()

function number

static inline constexpr static uint64_t number()

function extract_secondary_key

static inline auto extract_secondary_key(
const T & obj
)

function cbegin

inline const_iterator cbegin() const

function begin

inline const_iterator begin() const

function cend

inline const_iterator cend() const

function end

inline const_iterator end() const

function crbegin

inline const_reverse_iterator crbegin() const

function rbegin

inline const_reverse_iterator rbegin() const

function crend

inline const_reverse_iterator crend() const

function rend

inline const_reverse_iterator rend() const

function find

inline const_iterator find(
secondary_key_type && secondary
) const

function find

inline const_iterator find(
const secondary_key_type & secondary
) const

function require_find

inline const_iterator require_find(
secondary_key_type && secondary,
const char * error_msg ="unable to findsecondary key"
) const

function require_find

inline const_iterator require_find(
const secondary_key_type & secondary,
const char * error_msg ="unable to findsecondary key"
) const

function get

inline const T & get(
secondary_key_type && secondary,
const char * error_msg ="unable to findsecondary key"
) const

Gets the object with the smallest primary key in the case where the secondary key is not unique.

Avoid the common pitfall of copy-assigning the T& reference returned to a stack-allocated local variable and then passing that into modify of the multi-index. The most common mistake is when the local variable is defined as auto typename, instead it should be of type auto& or decltype(auto).

function get

inline const T & get(
const secondary_key_type & secondary,
const char * error_msg ="unable to findsecondary key"
) const

Gets the object with the smallest primary key in the case where the secondary key is not unique.

Avoid the common pitfall of copy-assigning the T& reference returned to a stack-allocated local variable and then passing that into modify of the multi-index. The most common mistake is when the local variable is defined as auto typename, instead it should be of type auto& or decltype(auto).

function lower_bound

inline const_iterator lower_bound(
secondary_key_type && secondary
) const

function lower_bound

inline const_iterator lower_bound(
const secondary_key_type & secondary
) const

function upper_bound

inline const_iterator upper_bound(
secondary_key_type && secondary
) const

function upper_bound

inline const_iterator upper_bound(
const secondary_key_type & secondary
) const

function iterator_to

inline const_iterator iterator_to(
const T & obj
)

Warning: the interator_to can have undefined behavior if the caller passes in a reference to a stack-allocated object rather than the reference returned by get or by dereferencing a const_iterator.

function modify

template <typename Lambda >
inline void modify(
const_iterator itr,
eosio::name payer,
Lambda && updater
)

function modify

template <typename Lambda >
inline void modify(
const T & obj,
eosio::name payer,
Lambda && updater
)

function erase

inline const_iterator erase(
const_iterator itr
)

function get_code

inline eosio::name get_code() const

function get_scope

inline uint64_t get_scope() const

Friends

friend multi_index

friend class multi_index(
multi_index
);

Updated on 2022-12-05 at 15:38:07 +0000