All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
paal::data_structures::bimap< T, Idx > Class Template Reference

implements both sides mapping from the collection to (0,size(collection)) interval. More...

#include <bimap.hpp>

Inheritance diagram for paal::data_structures::bimap< T, Idx >:
paal::data_structures::eraseable_bimap< T, Idx >

Public Types

typedef TToID::const_iterator Iterator
 

Public Member Functions

template<typename Range >
 bimap (Range &&range)
 constructor More...
 
Idx get_idx (const T &t) const
 gets index of element t More...
 
const T & get_val (Idx i) const
 get value for index i More...
 
std::size_t size () const
 number of elements More...
 
Idx add (const T &t)
 adds element to collection More...
 
std::pair< Iterator, Iterator > get_range () const
 get range of all element, index pairs More...
 

Protected Attributes

std::vector< T > m_id_to_t
 mapping from id to element
 
TToID m_t_to_id
 mapping from elements to ids
 

Detailed Description

template<typename T, typename Idx = int>
class paal::data_structures::bimap< T, Idx >

implements both sides mapping from the collection to (0,size(collection)) interval.

Template Parameters
T
Idx

Definition at line 123 of file bimap.hpp.

Constructor & Destructor Documentation

template<typename T, typename Idx = int>
template<typename Range >
paal::data_structures::bimap< T, Idx >::bimap ( Range &&  range)
inline

constructor

Template Parameters
Range
Parameters
range

Definition at line 137 of file bimap.hpp.

Member Function Documentation

template<typename T, typename Idx = int>
Idx paal::data_structures::bimap< T, Idx >::add ( const T &  t)
inline

adds element to collection

Parameters
t
Returns

Definition at line 188 of file bimap.hpp.

template<typename T, typename Idx = int>
Idx paal::data_structures::bimap< T, Idx >::get_idx ( const T &  t) const
inline

gets index of element t

Parameters
t
Returns

Definition at line 153 of file bimap.hpp.

template<typename T, typename Idx = int>
std::pair<Iterator, Iterator> paal::data_structures::bimap< T, Idx >::get_range ( ) const
inline

get range of all element, index pairs

Returns

Definition at line 201 of file bimap.hpp.

template<typename T, typename Idx = int>
const T& paal::data_structures::bimap< T, Idx >::get_val ( Idx  i) const
inline

get value for index i

Parameters
i
Returns

Definition at line 166 of file bimap.hpp.

template<typename T, typename Idx = int>
std::size_t paal::data_structures::bimap< T, Idx >::size ( ) const
inline

number of elements

Returns

Definition at line 179 of file bimap.hpp.


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