Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
utility::keys::KeyVector< K, T > Class Template Reference

Keyed-access vector. More...

#include <KeyVector.hh>

Public Types

typedefkey_type
 
typedef Vector::value_type value_type
 
typedef Vector::reference reference
 
typedef Vector::const_reference const_reference
 
typedef Vector::pointer pointer
 
typedef Vector::const_pointer const_pointer
 
typedef Vector::iterator iterator
 
typedef Vector::const_iterator const_iterator
 
typedef Vector::reverse_iterator reverse_iterator
 
typedef
Vector::const_reverse_iterator 
const_reverse_iterator
 
typedef Vector::size_type size_type
 
typedef Vector::index_type index_type
 
typedef Vector::difference_type difference_type
 
typedef Vector::allocator_type allocator_type
 
typedefKey
 
typedef Vector::Value Value
 
typedef Vector::Reference Reference
 
typedef Vector::ConstReference ConstReference
 
typedef Vector::Pointer Pointer
 
typedef Vector::ConstPointer ConstPointer
 
typedef Vector::Iterator Iterator
 
typedef Vector::ConstIterator ConstIterator
 
typedef Vector::ReverseIterator ReverseIterator
 
typedef
Vector::ConstReverseIterator 
ConstReverseIterator
 
typedef Vector::Size Size
 
typedef Vector::Index Index
 
typedef Vector::Difference Difference
 
typedef Vector::Allocator Allocator
 

Public Member Functions

 KeyVector ()=default
 Default constructor. More...
 
 KeyVector (Size const num)
 Size constructor. More...
 
 KeyVector (Size const num, Value const &value)
 Uniform value constructor. More...
 
template<typename InputIterator >
 KeyVector (InputIterator const beg, InputIterator const end)
 Iterator range constructor. More...
 
 ~KeyVector ()=default
 Destructor. More...
 
KeyVectoroperator= (KeyVector const &a)
 Copy assignment. More...
 
KeyVectoroperator= (Value const &value)
 Uniform value assignment to elements. More...
 
KeyVectorassign (Key const &key, Value const &value)
 Assign a value to an element with a key. More...
 
void assign (Size const num, Value const &value)
 Uniform value assignment. More...
 
template<typename InputIterator >
void assign (InputIterator const beg, InputIterator const end)
 Iterator assignment. More...
 
KeyVectoradd (Key const &key)
 Add an element with a key if not present. More...
 
Iterator insert (Iterator const pos, Value const &value)
 Insert an element at an iterator position. More...
 
void insert (Iterator const pos, Size const num, Value const &value)
 Insert num copies of an element at an iterator position. More...
 
template<typename InputIterator >
void insert (Iterator const pos, InputIterator const beg, InputIterator const end)
 Insert elements from iterator range [beg,end) at an iterator position. More...
 
void push_back (Value const &value)
 Appends an element. More...
 
Iterator erase (Iterator const pos)
 Erase an element at an iterator position. More...
 
Iterator erase (Iterator const beg, Iterator const end)
 Erase elements in the iterator range [beg,end) More...
 
void pop_back ()
 Removes the last element. More...
 
void resize (Size const num)
 Resize: Default construct new elements. More...
 
void resize (Size const num, Value const &value)
 Resize: Assign given value to new elements. More...
 
void reserve (Size const num)
 Reserve space for a given number of elements. More...
 
void shrink ()
 Shrink the vector to remove unused capacity. More...
 
void swap (KeyVector &a)
 swap( KeyVector ) More...
 
void clear ()
 Clear the vector. More...
 
Size size () const
 Size. More...
 
bool empty () const
 Empty? More...
 
Size max_size () const
 Max size. More...
 
Size capacity () const
 Capacity. More...
 
ConstReference front () const
 Front element. More...
 
Reference front ()
 Front element. More...
 
ConstReference back () const
 Back element. More...
 
Reference back ()
 Back element. More...
 
bool has (Key const &key) const
 Is an element with a key present? More...
 
bool active (Key const &key) const
 Is a key active? More...
 
bool inactive (Key const &key) const
 Is a key inactive? More...
 
ConstIterator find (Key const &key) const
 Iterator to element with a key. More...
 
Iterator find (Key const &key)
 Iterator to element with a key. More...
 
Reference operator() (Key const &key)
 KeyVector( key ) More...
 
ConstReference operator[] (Key const &key) const
 KeyVector[ key ] const. More...
 
Reference operator[] (Key const &key)
 KeyVector[ key ]. More...
 
ConstReference at (Key const &key) const
 Element at index key: Bounds checked. More...
 
Reference at (Key const &key)
 Element at index key: Bounds checked. More...
 
ConstIterator begin () const
 Begin iterator. More...
 
Iterator begin ()
 Begin iterator. More...
 
ConstIterator end () const
 End iterator. More...
 
Iterator end ()
 End iterator. More...
 
ConstReverseIterator rbegin () const
 Begin reverse iterator. More...
 
ReverseIterator rbegin ()
 Begin reverse iterator. More...
 
ConstReverseIterator rend () const
 End reverse iterator. More...
 
ReverseIterator rend ()
 End reverse iterator. More...
 

Private Types

typedef vector1< TVector
 

Private Member Functions

Key const & add_key (Key const &key)
 Add an element with a key if not present and return its key. More...
 

Private Attributes

Vector v_
 Vector of values indexed by keys. More...
 

Friends

template<typename UK , typename UT >
void swap (KeyVector< UK, UT > &a, KeyVector< UK, UT > &b)
 swap( KeyVector, KeyVector ) More...
 
bool operator== (KeyVector const &a, KeyVector const &b)
 KeyVector == KeyVector. More...
 
bool operator!= (KeyVector const &a, KeyVector const &b)
 KeyVector != KeyVector. More...
 

Detailed Description

template<typename K, typename T>
class utility::keys::KeyVector< K, T >

Keyed-access vector.

Member Typedef Documentation

template<typename K, typename T>
typedef Vector::Allocator utility::keys::KeyVector< K, T >::Allocator
template<typename K, typename T>
typedef Vector::allocator_type utility::keys::KeyVector< K, T >::allocator_type
template<typename K, typename T>
typedef Vector::const_iterator utility::keys::KeyVector< K, T >::const_iterator
template<typename K, typename T>
typedef Vector::const_pointer utility::keys::KeyVector< K, T >::const_pointer
template<typename K, typename T>
typedef Vector::ConstIterator utility::keys::KeyVector< K, T >::ConstIterator
template<typename K, typename T>
typedef Vector::ConstPointer utility::keys::KeyVector< K, T >::ConstPointer
template<typename K, typename T>
typedef Vector::ConstReference utility::keys::KeyVector< K, T >::ConstReference
template<typename K, typename T>
typedef Vector::Difference utility::keys::KeyVector< K, T >::Difference
template<typename K, typename T>
typedef Vector::Index utility::keys::KeyVector< K, T >::Index
template<typename K, typename T>
typedef Vector::index_type utility::keys::KeyVector< K, T >::index_type
template<typename K, typename T>
typedef Vector::iterator utility::keys::KeyVector< K, T >::iterator
template<typename K, typename T>
typedef Vector::Iterator utility::keys::KeyVector< K, T >::Iterator
template<typename K, typename T>
typedef K utility::keys::KeyVector< K, T >::Key
template<typename K, typename T>
typedef K utility::keys::KeyVector< K, T >::key_type
template<typename K, typename T>
typedef Vector::pointer utility::keys::KeyVector< K, T >::pointer
template<typename K, typename T>
typedef Vector::Pointer utility::keys::KeyVector< K, T >::Pointer
template<typename K, typename T>
typedef Vector::reference utility::keys::KeyVector< K, T >::reference
template<typename K, typename T>
typedef Vector::Reference utility::keys::KeyVector< K, T >::Reference
template<typename K, typename T>
typedef Vector::Size utility::keys::KeyVector< K, T >::Size
template<typename K, typename T>
typedef Vector::size_type utility::keys::KeyVector< K, T >::size_type
template<typename K, typename T>
typedef Vector::Value utility::keys::KeyVector< K, T >::Value
template<typename K, typename T>
typedef Vector::value_type utility::keys::KeyVector< K, T >::value_type
template<typename K, typename T>
typedef vector1< T > utility::keys::KeyVector< K, T >::Vector
private

Constructor & Destructor Documentation

template<typename K, typename T>
utility::keys::KeyVector< K, T >::KeyVector ( )
inlinedefault

Default constructor.

template<typename K, typename T>
utility::keys::KeyVector< K, T >::KeyVector ( Size const  num)
inlineexplicit

Size constructor.

template<typename K, typename T>
utility::keys::KeyVector< K, T >::KeyVector ( Size const  num,
Value const &  value 
)
inline

Uniform value constructor.

template<typename K, typename T>
template<typename InputIterator >
utility::keys::KeyVector< K, T >::KeyVector ( InputIterator const  beg,
InputIterator const  end 
)
inline

Iterator range constructor.

template<typename K, typename T>
utility::keys::KeyVector< K, T >::~KeyVector ( )
inlinedefault

Destructor.

Member Function Documentation

template<typename K, typename T>
bool utility::keys::KeyVector< K, T >::active ( Key const &  key) const
inline
template<typename K, typename T>
KeyVector& utility::keys::KeyVector< K, T >::add ( Key const &  key)
inline

Add an element with a key if not present.

References utility::keys::KeyVector< K, T >::add_key().

template<typename K, typename T>
Key const& utility::keys::KeyVector< K, T >::add_key ( Key const &  key)
inlineprivate
template<typename K, typename T>
KeyVector& utility::keys::KeyVector< K, T >::assign ( Key const &  key,
Value const &  value 
)
inline

Assign a value to an element with a key.

Note
Expands the vector if necessary

References utility::keys::KeyVector< K, T >::add_key(), utility::keys::KeyVector< K, T >::v_, and value.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::assign ( Size const  num,
Value const &  value 
)
inline

Uniform value assignment.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
template<typename InputIterator >
void utility::keys::KeyVector< K, T >::assign ( InputIterator const  beg,
InputIterator const  end 
)
inline

Iterator assignment.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstReference utility::keys::KeyVector< K, T >::at ( Key const &  key) const
inline

Element at index key: Bounds checked.

References utility::vectorL< SSize, T, A >::at(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Reference utility::keys::KeyVector< K, T >::at ( Key const &  key)
inline

Element at index key: Bounds checked.

References utility::vectorL< SSize, T, A >::at(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstReference utility::keys::KeyVector< K, T >::back ( ) const
inline

Back element.

References debug_assert, and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Reference utility::keys::KeyVector< K, T >::back ( )
inline

Back element.

References debug_assert, and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstIterator utility::keys::KeyVector< K, T >::begin ( ) const
inline

Begin iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::begin ( )
inline

Begin iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Size utility::keys::KeyVector< K, T >::capacity ( ) const
inline

Capacity.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::clear ( )
inline

Clear the vector.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
bool utility::keys::KeyVector< K, T >::empty ( ) const
inline
template<typename K, typename T>
ConstIterator utility::keys::KeyVector< K, T >::end ( ) const
inline

End iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::end ( )
inline

End iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::erase ( Iterator const  pos)
inline

Erase an element at an iterator position.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::erase ( Iterator const  beg,
Iterator const  end 
)
inline

Erase elements in the iterator range [beg,end)

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstIterator utility::keys::KeyVector< K, T >::find ( Key const &  key) const
inline

Iterator to element with a key.

References utility::keys::KeyVector< K, T >::active(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::find ( Key const &  key)
inline

Iterator to element with a key.

References utility::keys::KeyVector< K, T >::active(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstReference utility::keys::KeyVector< K, T >::front ( ) const
inline

Front element.

References debug_assert, and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Reference utility::keys::KeyVector< K, T >::front ( )
inline

Front element.

References debug_assert, and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
bool utility::keys::KeyVector< K, T >::has ( Key const &  key) const
inline

Is an element with a key present?

References utility::vectorL< SSize, T, A >::has(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
bool utility::keys::KeyVector< K, T >::inactive ( Key const &  key) const
inline
template<typename K, typename T>
Iterator utility::keys::KeyVector< K, T >::insert ( Iterator const  pos,
Value const &  value 
)
inline

Insert an element at an iterator position.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::insert ( Iterator const  pos,
Size const  num,
Value const &  value 
)
inline

Insert num copies of an element at an iterator position.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
template<typename InputIterator >
void utility::keys::KeyVector< K, T >::insert ( Iterator const  pos,
InputIterator const  beg,
InputIterator const  end 
)
inline

Insert elements from iterator range [beg,end) at an iterator position.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Size utility::keys::KeyVector< K, T >::max_size ( ) const
inline

Max size.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Reference utility::keys::KeyVector< K, T >::operator() ( Key const &  key)
inline

KeyVector( key )

Note
Expands the vector if necessary

References utility::keys::KeyVector< K, T >::add_key(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
KeyVector& utility::keys::KeyVector< K, T >::operator= ( KeyVector< K, T > const &  a)
inline

Copy assignment.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
KeyVector& utility::keys::KeyVector< K, T >::operator= ( Value const &  value)
inline

Uniform value assignment to elements.

References test.T009_Exceptions::e, utility::keys::KeyVector< K, T >::v_, and value.

template<typename K, typename T>
ConstReference utility::keys::KeyVector< K, T >::operator[] ( Key const &  key) const
inline
template<typename K, typename T>
Reference utility::keys::KeyVector< K, T >::operator[] ( Key const &  key)
inline
template<typename K, typename T>
void utility::keys::KeyVector< K, T >::pop_back ( )
inline

Removes the last element.

References debug_assert, and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::push_back ( Value const &  value)
inline

Appends an element.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstReverseIterator utility::keys::KeyVector< K, T >::rbegin ( ) const
inline

Begin reverse iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ReverseIterator utility::keys::KeyVector< K, T >::rbegin ( )
inline

Begin reverse iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ConstReverseIterator utility::keys::KeyVector< K, T >::rend ( ) const
inline

End reverse iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
ReverseIterator utility::keys::KeyVector< K, T >::rend ( )
inline

End reverse iterator.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::reserve ( Size const  num)
inline

Reserve space for a given number of elements.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::resize ( Size const  num)
inline

Resize: Default construct new elements.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::resize ( Size const  num,
Value const &  value 
)
inline

Resize: Assign given value to new elements.

References utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
void utility::keys::KeyVector< K, T >::shrink ( )
inline

Shrink the vector to remove unused capacity.

References utility::vectorL< SSize, T, A >::shrink(), and utility::keys::KeyVector< K, T >::v_.

template<typename K, typename T>
Size utility::keys::KeyVector< K, T >::size ( ) const
inline
template<typename K, typename T>
void utility::keys::KeyVector< K, T >::swap ( KeyVector< K, T > &  a)
inline

Friends And Related Function Documentation

template<typename K, typename T>
bool operator!= ( KeyVector< K, T > const &  a,
KeyVector< K, T > const &  b 
)
friend
template<typename K, typename T>
bool operator== ( KeyVector< K, T > const &  a,
KeyVector< K, T > const &  b 
)
friend
template<typename K, typename T>
template<typename UK , typename UT >
void swap ( KeyVector< UK, UT > &  a,
KeyVector< UK, UT > &  b 
)
friend

swap( KeyVector, KeyVector )

Member Data Documentation

template<typename K, typename T>
Vector utility::keys::KeyVector< K, T >::v_
private

The documentation for this class was generated from the following files: