Aleph-w  1.9
General library for algorithms and data structures
MapSequencesMethods< Container, Key, Data > Class Template Reference

#include <ah-dry.H>

Public Member Functions

template<template< typename > class C = DynList>
C< Key > keys () const
 
template<template< typename > class C = DynList>
C< Data > values () const
 
template<template< typename > class C = DynList>
C< Data * > values_ptr () const
 
template<template< typename > class C = DynList>
C< std::pair< Key, Data > > items () const
 
template<template< typename > class C = DynList>
C< std::pair< Key, Data * > > items_ptr () const
 
Data & operator() (const Key &key)
 
const Data & operator() (const Key &key) const
 

Detailed Description

template<class Container, typename Key, typename Data>
class MapSequencesMethods< Container, Key, Data >

Common methods to mapping containers.

Member Function Documentation

◆ items()

template<class Container , typename Key , typename Data >
template<template< typename > class C = DynList>
C<std::pair<Key, Data> > MapSequencesMethods< Container, Key, Data >::items ( ) const
inline

Return a container with the entire mapping.

items() returns a container copy of an entire mapping. Each element of returned mapping is a pair <key, value>.

Returns
A new container, according the passed template parameter, containing all the pairs key,value of mapping.
Exceptions
bad_allocif there is no enough memory

◆ items_ptr()

template<class Container , typename Key , typename Data >
template<template< typename > class C = DynList>
C<std::pair<Key, Data*> > MapSequencesMethods< Container, Key, Data >::items_ptr ( ) const
inline

Return a container with the entire mapping where the range could be modified.

items_ptr() returns a container copy of an entire mapping. Each element of returned mapping is a pair <key, pointer to value>.

Returns
A new container, according the passed template parameter, containing all the pairs key,pointer-value of mapping.
Exceptions
bad_allocif there is no enough memory

◆ keys()

template<class Container , typename Key , typename Data >
template<template< typename > class C = DynList>
C<Key> MapSequencesMethods< Container, Key, Data >::keys ( ) const
inline

Return the domain set of container.

This is a template method whose unique parameter is the type of container where the domain set will be stored. By default this type is DynList.

Often the elements of domain are called "keys" and those of codomain or range "values".

Returns
A new container, according the passed template parameter, containing all the elements of domain of mapping.
Exceptions
bad_allocif there is no enough memory

◆ operator()() [1/2]

template<class Container , typename Key , typename Data >
Data& MapSequencesMethods< Container, Key, Data >::operator() ( const Key &  key)
inline

Return the image or element mapped to key.

Returns
a modifiable reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping

◆ operator()() [2/2]

template<class Container , typename Key , typename Data >
const Data& MapSequencesMethods< Container, Key, Data >::operator() ( const Key &  key) const
inline

Return the image or element mapped to key.

Returns
a constant reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping.

◆ values()

template<class Container , typename Key , typename Data >
template<template< typename > class C = DynList>
C<Data> MapSequencesMethods< Container, Key, Data >::values ( ) const
inline

Return the range set of container.

This is a template method whose unique parameter is the type of container where the range set will be stored. By default this type is DynList.

Often the elements of range are called "value" and those of domain "values".

Returns
A new container, according the passed template parameter, containing all the elements of range of mapping.
Exceptions
bad_allocif there is no enough memory

◆ values_ptr()

template<class Container , typename Key , typename Data >
template<template< typename > class C = DynList>
C<Data*> MapSequencesMethods< Container, Key, Data >::values_ptr ( ) const
inline

Return a container of pointers to the elements of range set of container.

This is a template method whose unique parameter is the type of container where the pointers set will be stored. By default this type is DynList.

Often the elements of range are called "value" and those of domain "values". This method returns a container with pointers to those elements. In this way, the value could be modified.

Returns
A new container, according the passed template parameter, containing all the pointers to elements of range of mapping.
Exceptions
bad_allocif there is no enough memory

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

Leandro Rabindranath León