4.3.0
|
|
Freundlich's C++ toolkit |
An index-based container that grows on demand.
This container is a wrapper around a vector that grows on demand. If the container is accessed with an out-of-bounds index, it inserts a new element first. This is most useful with fcppt::optional::object.
T | The element type. |
A | The allocator type. |
Public Types | |
using | internal_type = std::vector< T, A > |
using | size_type = typename internal_type::size_type |
using | reference = typename internal_type::reference |
using | insert_function = fcppt::function< T()> |
Public Member Functions | |
index_map () | |
reference | get (size_type index, insert_function insert) |
Returns the element at an index or inserts new ones using a function. More... | |
reference | operator[] (size_type index) |
Returns the element at an index or inserts new default-constructed one. More... | |
internal_type const & | impl () const |
using fcppt::container::index_map< T, A >::insert_function = fcppt::function<T()> |
using fcppt::container::index_map< T, A >::internal_type = std::vector<T, A> |
using fcppt::container::index_map< T, A >::reference = typename internal_type::reference |
using fcppt::container::index_map< T, A >::size_type = typename internal_type::size_type |
fcppt::container::index_map< T, A >::index_map | ( | ) |
reference fcppt::container::index_map< T, A >::get | ( | size_type | index, |
insert_function | insert | ||
) |
Returns the element at an index or inserts new ones using a function.
Returns the element at index. If there is no such element, the result of insert()
is inserted. Note that insert might be called multiple times.
internal_type const & fcppt::container::index_map< T, A >::impl | ( | ) | const |
reference fcppt::container::index_map< T, A >::operator[] | ( | size_type | index | ) |
Returns the element at an index or inserts new default-constructed one.
Returns the element at index. If there is no such element, T()
is inserted.