Has many relation class using a std::vector as container. More...
#include <container.hpp>
Inherits abstract_container.
Public Types | |
using | traits = container_iterator_traits< Type, ContainerType > |
using | iterator = container_iterator< Type, ContainerType > |
using | const_iterator = const_container_iterator< Type, ContainerType > |
using | value_type = typename traits::value_type |
using | holder_type = typename traits::holder_type |
using | holder_container_type = typename traits::holder_container_type |
using | size_type = typename holder_container_type::size_type |
Public Member Functions | |
template<typename U = Type> | |
container () | |
Creates an empty container object. | |
template<typename U = Type> | |
container (size_t size) | |
iterator | begin () |
Returns the begin iterator of the container. | |
iterator | end () |
Returns the end iterator of the container. | |
const_iterator | begin () const |
Returns the const begin iterator of the container. | |
const_iterator | end () const |
Returns the const end iterator of the container. | |
value_type | front () |
Returns a copy of the first element. | |
value_type | front () const |
Returns a const copy of the first element. | |
value_type | back () |
Returns a const copy of the first element. | |
value_type | back () const |
Returns a const copy of the last element. | |
size_type | size () const |
Returns the current size of the container. | |
bool | empty () const |
Returns true if the container is empty. | |
void | reset () |
Clears the container. | |
void | append (const typename iterator::holder_type &item) |
Appends an item to the end of the container. | |
iterator | insert (iterator pos, const value_type &value) |
Inserts an element at the given position. | |
template<template< class ... > class C = ContainerType> | |
void | push_front (const value_type &value) |
Inserts an element at first position. | |
void | push_back (const value_type &value) |
Inserts an element at last position. | |
void | clear () |
Clears the vector. | |
iterator | remove (const value_type &value) |
template<class P > | |
iterator | remove_if (P predicate) |
iterator | erase (iterator i) |
Remove the element at given position. | |
iterator | erase (iterator start, iterator end) |
Remove the elements of given range. | |
template<class P > | |
iterator | find_if (P predicate) |
Finds an element matching the predicate. | |
Public Attributes | |
size_t | size_ {} |
Has many relation class using a std::vector as container.
The has many relation class uses a std::vector as internal container to store the objects.
It provides all main interface functions std::vector provides
All of these methods are wrapped around the std::vector methods plus the modification in the corresponding object_store and notification of the transaction observer
The relation holds object_ptr elements as well as scalar data elements.
Type | The type of the elements |
using matador::container< Type, ContainerType >::const_iterator = const_container_iterator<Type, ContainerType> |
Shortcut to iterator class
using matador::container< Type, ContainerType >::holder_container_type = typename traits::holder_container_type |
Shortcut to container type
using matador::container< Type, ContainerType >::holder_type = typename traits::holder_type |
Shortcut to holder_type
using matador::container< Type, ContainerType >::iterator = container_iterator<Type, ContainerType> |
Shortcut to iterator class
using matador::container< Type, ContainerType >::size_type = typename holder_container_type::size_type |
Shortcut to size_type
using matador::container< Type, ContainerType >::traits = container_iterator_traits<Type, ContainerType> |
Shortcut to traits class
using matador::container< Type, ContainerType >::value_type = typename traits::value_type |
Shortcut to value_type
|
inline |
Creates an empty container object.
Creates an empty container object with a std::vector as container type
|
inline |
Appends an item to the end of the container.
item | Element to be appended |
|
inline |
Returns a const copy of the first element.
|
inline |
Returns a const copy of the last element.
|
inline |
Returns the begin iterator of the container.
|
inline |
Returns the const begin iterator of the container.
|
inline |
Returns true if the container is empty.
|
inline |
Returns the end iterator of the container.
|
inline |
Returns the const end iterator of the container.
|
inline |
Remove the element at given position.
Erase the element at given position and return the iterator following the last removed element.
i | Iterator to the element to remove |
|
inline |
Remove the elements of given range.
Remove the elements of the given range identified by the first and last iterator position. Where the first iterator is included and the last iterator is not included [first; last)
start | First iterator of the range |
end | Last iterator of the ranges |
|
inline |
|
inline |
Returns a copy of the first element.
|
inline |
Returns a const copy of the first element.
|
inline |
Inserts an element at the given position.
pos | The position to insert at |
value | The element to be inserted |
|
inline |
Inserts an element at last position.
value | The element to be inserted |
|
inline |
Inserts an element at first position.
value | The element to be inserted |
|
inline |
Removes all values equal to given value from the container
value | Value to remove |
|
inline |
Removes all elements from the container for which the given predicate returns true.
P | Type of the predicate |
predicate | Predicate to be evaluated |
|
inline |
Returns the current size of the container.