HomeManualTopicsTypesSymbols

std::length_of

returns the number of items within a collection

Parameter

collection
the collection to be analyzed

Result

length
the number of items within collection

Description

Many collections just store this value explicitely, making this a very cheap operation.

But there are collections which must traverse all its contents to compute the total number of stored items, making this a very expensive operation!

Topics

Strings

Lists

Collections

See also

std::is_empty checks whether a collection contains any items

Implemented by

std_types::association_list returns the number of items in the association list
std_types::hash_set returns the number of items in the hash set
std_types::hash_table returns the number of items in the hash table
std_types::key_order_set returns the number of items in the key-order set
std_types::key_order_table returns the number of items in the key-order table
std_types::list returns the number of items within the list
std_types::octet_string returns the number of items within the list
std_types::quad_octet_string returns the number of items within the list
std_types::value_range returns the number of values within the range