Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

reference_flat_map< TKey, TValue, MAX_SIZE_, TCompare > Class Template Reference

reference_flat_map< TKey, TValue, MAX_SIZE_, TCompare > Class Template Reference
[reference_flat_map]

A reference_flat_map implementation that uses a fixed size buffer. More...

#include <reference_flat_map.h>

Inherits ireference_flat_map< TKey, TValue, TCompare >.

Public Member Functions

 reference_flat_map ()
 Constructor.
template<typename TIterator >
 reference_flat_map (TIterator first, TIterator last)
 Constructor, from an iterator range.
 ~reference_flat_map ()
 Destructor.
reference_flat_mapoperator= (const reference_flat_map &rhs)
 Assignment operator.
iterator begin ()
 Returns an iterator to the beginning of the reference_flat_map.
const_iterator begin () const
 Returns a const_iterator to the beginning of the reference_flat_map.
iterator end ()
 Returns an iterator to the end of the reference_flat_map.
const_iterator end () const
 Returns a const_iterator to the end of the reference_flat_map.
const_iterator cbegin () const
 Returns a const_iterator to the beginning of the reference_flat_map.
const_iterator cend () const
 Returns a const_iterator to the end of the reference_flat_map.
reverse_iterator rbegin ()
 Returns an reverse iterator to the reverse beginning of the reference_flat_map.
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the reverse beginning of the reference_flat_map.
reverse_iterator rend ()
 Returns a reverse iterator to the end + 1 of the reference_flat_map.
const_reverse_iterator rend () const
 Returns a const reverse iterator to the end + 1 of the reference_flat_map.
const_reverse_iterator crbegin () const
 Returns a const reverse iterator to the reverse beginning of the reference_flat_map.
const_reverse_iterator crend () const
 Returns a const reverse iterator to the end + 1 of the reference_flat_map.
mapped_type & operator[] (key_parameter_t key)
 Returns a reference to the value at index 'key'.
const mapped_type & operator[] (key_parameter_t key) const
 Returns a const reference to the value at index 'key'.
mapped_type & at (key_parameter_t key)
 Returns a reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::flat_map_out_of_bounds if the key is not in the range.
const mapped_type & at (key_parameter_t key) const
 Returns a const reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::flat_map_out_of_bounds if the key is not in the range.
void assign (TIterator first, TIterator last)
 Assigns values to the reference_flat_map.
std::pair< iterator, bool > insert (reference value)
 Inserts a value to the reference_flat_map.
iterator insert (iterator position, reference value)
 Inserts a value to the reference_flat_map.
void insert (TIterator first, TIterator last)
 Inserts a range of values to the reference_flat_map.
size_t erase (key_parameter_t key)
 Erases an element.
void erase (iterator i_element)
 Erases an element.
void erase (iterator first, iterator last)
 Erases a range of elements.
void clear ()
 Clears the reference_flat_map.
iterator find (key_parameter_t key)
 Finds an element.
const_iterator find (key_parameter_t key) const
 Finds an element.
size_t count (key_parameter_t key) const
 Counts an element.
iterator lower_bound (key_parameter_t key)
 Finds the lower bound of a key.
const_iterator lower_bound (key_parameter_t key) const
 Finds the lower bound of a key.
iterator upper_bound (key_parameter_t key)
 Finds the upper bound of a key.
const_iterator upper_bound (key_parameter_t key) const
 Finds the upper bound of a key.
std::pair< iterator, iterator > equal_range (key_parameter_t key)
 Finds the range of equal elements of a key.
std::pair< const_iterator,
const_iterator > 
equal_range (key_parameter_t key) const
 Finds the range of equal elements of a key.
size_type size () const
 Gets the current size of the reference_flat_map.
bool empty () const
 Checks the 'empty' state of the reference_flat_map.
bool full () const
 Checks the 'full' state of the reference_flat_map.
size_type capacity () const
 Returns the capacity of the reference_flat_map.
size_type max_size () const
 Returns the maximum possible size of the reference_flat_map.
size_t available () const
 Returns the remaining capacity.

Protected Member Functions

std::pair< iterator, bool > insert_at (iterator i_element, value_type &value)
 Inserts a value to the reference_flat_map.

Detailed Description

template<typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = std::less<TKey>>
class etl::reference_flat_map< TKey, TValue, MAX_SIZE_, TCompare >

A reference_flat_map implementation that uses a fixed size buffer.

Template Parameters:
TKeyThe key type.
TValueThe value type.
TCompareThe type to compare keys. Default = std::less<TKey>
MAX_SIZE_The maximum number of elements that can be stored.

Definition at line 894 of file reference_flat_map.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 903 of file reference_flat_map.h.

reference_flat_map ( TIterator  first,
TIterator  last 
)

Constructor, from an iterator range.

Template Parameters:
TIteratorThe iterator type.
Parameters:
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

Definition at line 915 of file reference_flat_map.h.

Destructor.

Definition at line 924 of file reference_flat_map.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
) [inherited]

Assigns values to the reference_flat_map.

If ETL_THROW_EXCEPTIONS & ETL_DEBUG are defined, emits flat_map_full if the reference_flat_map does not have enough free space. If ETL_THROW_EXCEPTIONS & ETL_DEBUG are defined, emits flat_map_iterator if the iterators are reversed.

Parameters:
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 523 of file reference_flat_map.h.

mapped_type& at ( key_parameter_t  key ) [inherited]

Returns a reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::flat_map_out_of_bounds if the key is not in the range.

Parameters:
iThe index.
Returns:
A reference to the value at index 'key'

Definition at line 491 of file reference_flat_map.h.

const mapped_type& at ( key_parameter_t  key ) const [inherited]

Returns a const reference to the value at index 'key' If asserts or exceptions are enabled, emits an etl::flat_map_out_of_bounds if the key is not in the range.

Parameters:
iThe index.
Returns:
A const reference to the value at index 'key'

Definition at line 506 of file reference_flat_map.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 799 of file reference_flat_map.h.

iterator begin (  ) [inherited]

Returns an iterator to the beginning of the reference_flat_map.

Returns:
An iterator to the beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 353 of file reference_flat_map.h.

const_iterator begin (  ) const [inherited]

Returns a const_iterator to the beginning of the reference_flat_map.

Returns:
A const iterator to the beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 362 of file reference_flat_map.h.

size_type capacity (  ) const [inherited]

Returns the capacity of the reference_flat_map.

Returns:
The capacity of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 781 of file reference_flat_map.h.

const_iterator cbegin (  ) const [inherited]

Returns a const_iterator to the beginning of the reference_flat_map.

Returns:
A const iterator to the beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 389 of file reference_flat_map.h.

const_iterator cend (  ) const [inherited]

Returns a const_iterator to the end of the reference_flat_map.

Returns:
A const iterator to the end of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 398 of file reference_flat_map.h.

void clear (  ) [inherited]

Clears the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 623 of file reference_flat_map.h.

size_t count ( key_parameter_t  key ) const [inherited]

Counts an element.

Parameters:
keyThe key to search for.
Returns:
1 if the key exists, otherwise 0.

Definition at line 681 of file reference_flat_map.h.

const_reverse_iterator crbegin (  ) const [inherited]

Returns a const reverse iterator to the reverse beginning of the reference_flat_map.

Returns:
Const reverse iterator to the reverse beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 443 of file reference_flat_map.h.

const_reverse_iterator crend (  ) const [inherited]

Returns a const reverse iterator to the end + 1 of the reference_flat_map.

Returns:
Const reverse iterator to the end + 1 of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 452 of file reference_flat_map.h.

bool empty (  ) const [inherited]

Checks the 'empty' state of the reference_flat_map.

Returns:
true if empty.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 763 of file reference_flat_map.h.

iterator end (  ) [inherited]

Returns an iterator to the end of the reference_flat_map.

Returns:
An iterator to the end of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 371 of file reference_flat_map.h.

const_iterator end (  ) const [inherited]

Returns a const_iterator to the end of the reference_flat_map.

Returns:
A const iterator to the end of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 380 of file reference_flat_map.h.

std::pair<iterator, iterator> equal_range ( key_parameter_t  key ) [inherited]

Finds the range of equal elements of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator pair.

Definition at line 731 of file reference_flat_map.h.

std::pair<const_iterator, const_iterator> equal_range ( key_parameter_t  key ) const [inherited]

Finds the range of equal elements of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator pair.

Definition at line 743 of file reference_flat_map.h.

size_t erase ( key_parameter_t  key ) [inherited]

Erases an element.

Parameters:
keyThe key to erase.
Returns:
The number of elements erased. 0 or 1.

Definition at line 584 of file reference_flat_map.h.

void erase ( iterator  i_element ) [inherited]

Erases an element.

Parameters:
i_elementIterator to the element.

Definition at line 603 of file reference_flat_map.h.

void erase ( iterator  first,
iterator  last 
) [inherited]

Erases a range of elements.

The range includes all the elements between first and last, including the element pointed by first, but not the one pointed by last.

Parameters:
firstIterator to the first element.
lastIterator to the last element.

Definition at line 615 of file reference_flat_map.h.

iterator find ( key_parameter_t  key ) [inherited]

Finds an element.

Parameters:
keyThe key to search for.
Returns:
An iterator pointing to the element or end() if not found.

Definition at line 633 of file reference_flat_map.h.

const_iterator find ( key_parameter_t  key ) const [inherited]

Finds an element.

Parameters:
keyThe key to search for.
Returns:
An iterator pointing to the element or end() if not found.

Definition at line 657 of file reference_flat_map.h.

bool full (  ) const [inherited]

Checks the 'full' state of the reference_flat_map.

Returns:
true if full.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 772 of file reference_flat_map.h.

std::pair<iterator, bool> insert ( reference  value ) [inherited]

Inserts a value to the reference_flat_map.

If asserts or exceptions are enabled, emits flat_map_full if the reference_flat_map is already full.

Parameters:
valueThe value to insert.

Definition at line 545 of file reference_flat_map.h.

iterator insert ( iterator  position,
reference  value 
) [inherited]

Inserts a value to the reference_flat_map.

If asserts or exceptions are enabled, emits flat_map_full if the reference_flat_map is already full.

Parameters:
positionThe position to insert at.
valueThe value to insert.

Definition at line 558 of file reference_flat_map.h.

void insert ( TIterator  first,
TIterator  last 
) [inherited]

Inserts a range of values to the reference_flat_map.

If asserts or exceptions are enabled, emits flat_map_full if the reference_flat_map does not have enough free space.

Parameters:
positionThe position to insert at.
firstThe first element to add.
lastThe last + 1 element to add.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 571 of file reference_flat_map.h.

std::pair<iterator, bool> insert_at ( iterator  i_element,
value_type &  value 
) [protected, inherited]

Inserts a value to the reference_flat_map.

Parameters:
i_elementThe place to insert.
valueThe value to insert.

Definition at line 819 of file reference_flat_map.h.

iterator lower_bound ( key_parameter_t  key ) [inherited]

Finds the lower bound of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator.

Definition at line 691 of file reference_flat_map.h.

const_iterator lower_bound ( key_parameter_t  key ) const [inherited]

Finds the lower bound of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator.

Definition at line 701 of file reference_flat_map.h.

size_type max_size (  ) const [inherited]

Returns the maximum possible size of the reference_flat_map.

Returns:
The maximum size of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 790 of file reference_flat_map.h.

reference_flat_map& operator= ( const reference_flat_map< TKey, TValue, MAX_SIZE_, TCompare > &  rhs )

Assignment operator.

Definition at line 932 of file reference_flat_map.h.

const mapped_type& operator[] ( key_parameter_t  key ) const [inherited]

Returns a const reference to the value at index 'key'.

Parameters:
iThe index.
Returns:
A const reference to the value at index 'key'

Definition at line 476 of file reference_flat_map.h.

mapped_type& operator[] ( key_parameter_t  key ) [inherited]

Returns a reference to the value at index 'key'.

Parameters:
iThe index.
Returns:
A reference to the value at index 'key'

Definition at line 462 of file reference_flat_map.h.

const_reverse_iterator rbegin (  ) const [inherited]

Returns a const reverse iterator to the reverse beginning of the reference_flat_map.

Returns:
Const iterator to the reverse beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 416 of file reference_flat_map.h.

reverse_iterator rbegin (  ) [inherited]

Returns an reverse iterator to the reverse beginning of the reference_flat_map.

Returns:
Iterator to the reverse beginning of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 407 of file reference_flat_map.h.

reverse_iterator rend (  ) [inherited]

Returns a reverse iterator to the end + 1 of the reference_flat_map.

Returns:
Reverse iterator to the end + 1 of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 425 of file reference_flat_map.h.

const_reverse_iterator rend (  ) const [inherited]

Returns a const reverse iterator to the end + 1 of the reference_flat_map.

Returns:
Const reverse iterator to the end + 1 of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 434 of file reference_flat_map.h.

size_type size (  ) const [inherited]

Gets the current size of the reference_flat_map.

Returns:
The current size of the reference_flat_map.

Reimplemented in iflat_map< TKey, TValue, TCompare >.

Definition at line 754 of file reference_flat_map.h.

iterator upper_bound ( key_parameter_t  key ) [inherited]

Finds the upper bound of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator.

Definition at line 711 of file reference_flat_map.h.

const_iterator upper_bound ( key_parameter_t  key ) const [inherited]

Finds the upper bound of a key.

Parameters:
keyThe key to search for.
Returns:
An iterator.

Definition at line 721 of file reference_flat_map.h.