Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
MapSequencesMethods< Container, Key, Data > Class Template Reference

Common methods to mapping containers. More...

#include <ah-dry.H>

Public Member Functions

template<template< typename > class C = Aleph::DynList>
C< Key > keys () const
 Return the domain set of container.
 
template<template< typename > class C = Aleph::DynList>
C< Data > values () const
 Return the range set of container.
 
template<template< typename > class C = Aleph::DynList>
requires Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer<Container, C<Data>>::type, std::pair<Key, Data>>
C< Data * > values_ptr ()
 Return a container of pointers to the elements of range set of container.
 
template<template< typename > class C = Aleph::DynList>
C< const Data * > values_ptr () const
 Constant overload of values_ptr().
 
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, Data > > items () const
 Return a container with the entire mapping.
 
template<template< typename > class C = Aleph::DynList>
requires Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer<Container, C<Data>>::type, std::pair<Key, Data>>
C< std::pair< Key, Data * > > items_ptr ()
 Return a container with the entire mapping where the range could be modified.
 
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, const Data * > > items_ptr () const
 Constant overload of items_ptr().
 
Data & operator() (const Key &key)
 Return the image or element mapped to key.
 
const Data & operator() (const Key &key) const
 Return the image or element mapped to key.
 

Private Member Functions

const Container * const_me () const noexcept
 
Container * me () noexcept
 

Detailed Description

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

Common methods to mapping containers.

For containers whose items are std::pair<Key, Data>.

Definition at line 3189 of file ah-dry.H.

Member Function Documentation

◆ const_me()

◆ items()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::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

Definition at line 3305 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ items_ptr() [1/2]

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
requires Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer<Container, C<Data>>::type, std::pair<Key, Data>>
C< std::pair< Key, Data * > > MapSequencesMethods< Container, Key, Data >::items_ptr ( )
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>. It needs a container whose modifiable traversal hands out modifiable references.

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

Definition at line 3330 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::me().

◆ items_ptr() [2/2]

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

Constant overload of items_ptr().

Returns
A new container with pairs <key, constant pointer to value>.
Exceptions
bad_allocif there is no enough memory

Definition at line 3347 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ keys()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::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

Definition at line 3216 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ me()

template<class Container , typename Key , typename Data >
Container * MapSequencesMethods< Container, Key, Data >::me ( )
inlineprivatenoexcept

◆ 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.

Parameters
[in]keykey to look up.
Returns
a modifiable reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping

Definition at line 3363 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::me().

◆ 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.

Parameters
[in]keykey to look up.
Returns
a constant reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping.

Definition at line 3378 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ values()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::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 "values" and those of domain "keys".

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

Definition at line 3240 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ values_ptr() [1/2]

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
requires Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer<Container, C<Data>>::type, std::pair<Key, Data>>
C< Data * > MapSequencesMethods< Container, Key, Data >::values_ptr ( )
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.

This method returns a container with pointers to the values, so that they can be modified; it needs a container whose modifiable traversal hands out modifiable references.

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

Definition at line 3268 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::me().

◆ values_ptr() [2/2]

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

Constant overload of values_ptr().

Returns
A new container with constant pointers to the values.
Exceptions
bad_allocif there is no enough memory

Definition at line 3285 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().


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