AFF --- A container for numbers (array) by Friederich and Forbriger.
valmap.h
Go to the documentation of this file.
1 
35 // include guard
36 #ifndef AFF_VALMAP_H_VERSION
37 
38 #define AFF_VALMAP_H_VERSION \
39  "AFF_VALMAP_H V1.0 "
40 
41 #include<aff/lib/mapper.h>
42 #include<map>
43 
44 namespace aff {
45 
46  namespace func {
47 
48  namespace util {
49 
58  template<class T1, class T2>
59  class Mapvalmap {
60  public:
61  typedef T1 Tinvalue;
62  typedef T2 Toutvalue;
63  typedef std::map<Tinvalue,Toutvalue> Tmap;
65  Mapvalmap(const Tmap& m): Mmap(m) { }
67  Toutvalue operator() (Tinvalue v) const { return(Mmap[v]); }
68  private:
69  mutable Tmap Mmap;
70  }; // class Mapvalmap
71 
72  } // namespace util
73 
74 /*----------------------------------------------------------------------*/
75 
87  template<template <class> class C, class M>
88  C<typename M::mapped_type>
89  valmap(const typename C<typename M::key_type>::Tcoc& c,
90  const M& m)
91  {
92  typedef typename M::key_type Tinvalue;
93  typedef typename M::mapped_type Toutvalue;
96  } // valmap()
97 
98  } // namespace func
99 
100 } // namespace aff
101 
102 #endif // AFF_VALMAP_H_VERSION (includeguard)
103 
104 /* ----- END OF valmap.h ----- */
Root namespace of library.
Definition: array.h:148
map values (prototypes)
C< typename F::Toutvalue > mapvalues(const typename C< typename F::Tinvalue >::Tcoc &c, const F &exfun)
Definition: mapper.h:67
C< typename M::mapped_type > valmap(const typename C< typename M::key_type >::Tcoc &c, const M &m)
Definition: valmap.h:89
Toutvalue operator()(Tinvalue v) const
map another value
Definition: valmap.h:67
std::map< Tinvalue, Toutvalue > Tmap
Definition: valmap.h:63
Mapvalmap(const Tmap &m)
initialize member data
Definition: valmap.h:65