Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
StrictMapDelegate< C > Class Template Reference

#include <elm/delegate.h>

Public Types

typedef StrictMapDelegate< C > self_t
 
typedef C::key_t key_t
 
typedef C::val_t val_t
 

Public Member Functions

 StrictMapDelegate (C &map, const key_t &key)
 
val_t get (void) const
 
void put (const val_t &val)
 
 operator val_t (void) const
 
val_t operator* (void) const
 
self_toperator= (const val_t &val)
 

Detailed Description

template<class C>
class elm::StrictMapDelegate< C >

Delegate class to access functions get/put() of map using the overload of [i] operators. In the opposite to MapDelegate, this class throws a KeyException if the key of a read item does not exist.

A common use of this delegate in a class implementing a mutable map:

template <class K, class T>
class MyMap {
public:
typedef K key_t;
typedef T val_t;
...
inline StricMapDelegate<MyMap> operator[](const K& k)
{ return StrictMapDelegate<MyMap>(*this, k); }
...
};
Parameters
TType of map element values.
See also
MapDelegate

Member Typedef Documentation

◆ key_t

typedef C::key_t key_t

◆ self_t

◆ val_t

typedef C::val_t val_t

Constructor & Destructor Documentation

◆ StrictMapDelegate()

StrictMapDelegate ( C &  map,
const key_t key 
)
inline

Member Function Documentation

◆ get()

◆ operator val_t()

operator val_t ( void  ) const
inline

◆ operator*()

val_t operator* ( void  ) const
inline

◆ operator=()

self_t& operator= ( const val_t val)
inline

◆ put()

void put ( const val_t val)
inline

The documentation for this class was generated from the following file:
elm::StrictMapDelegate::val_t
C::val_t val_t
Definition: delegate.h:99
elm::StrictMapDelegate::key_t
C::key_t key_t
Definition: delegate.h:98