Public Member Functions

key_value_pair< ObjectType > Class Template Reference

A dispatch facility that unwraps type-erasued key-value type pairs. More...

#include <key_value_pair.hpp>

Public Member Functions

 key_value_pair ()
 key_value_pair (key_value_pair const &other)
 Copy CTOR. Takes ownership of the key-value-pair in order to store pairs in a vector.
 ~key_value_pair ()
 Destructor. Destroys the key-value pair only if it is the owner.
bool operator== (key_value_pair< ObjectType > const &other) const
 Compares two key_value_pairs for wrapping the same key and value types. See also key_value_pair_wrapper::operator==() for full details.
template<typename KeyType , typename DataType >
void add ()
 Wrap the two supplied types within the key_value_pair.
void copy (ObjectType const &src, ObjectType const &dest) const
 Copies data of the wrapped type to another object.
void erase (ObjectType const &el) const
 Erases data for the wrapped key and value type from the supplied object.

Detailed Description

template<typename ObjectType>
class viennadata::key_value_pair< ObjectType >

A dispatch facility that unwraps type-erasued key-value type pairs.

Refer to Alexandrescu, "Modern C++ Design" for details on type erasure

Template Parameters:
object_type The type of the object the data is associated with

Constructor & Destructor Documentation

key_value_pair (  )  [inline]
key_value_pair ( key_value_pair< ObjectType > const &  other  )  [inline]

Copy CTOR. Takes ownership of the key-value-pair in order to store pairs in a vector.

~key_value_pair (  )  [inline]

Destructor. Destroys the key-value pair only if it is the owner.


Member Function Documentation

void add (  )  [inline]

Wrap the two supplied types within the key_value_pair.

Template Parameters:
key_type Type of the key to be wrapped
value_type Type of the data to be wrapped
void copy ( ObjectType const &  src,
ObjectType const &  dest 
) const [inline]

Copies data of the wrapped type to another object.

Parameters:
src The source object
dest The destination object
void erase ( ObjectType const &  el  )  const [inline]

Erases data for the wrapped key and value type from the supplied object.

bool operator== ( key_value_pair< ObjectType > const &  other  )  const [inline]

Compares two key_value_pairs for wrapping the same key and value types. See also key_value_pair_wrapper::operator==() for full details.


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