AFF --- A container for numbers (array) by Friederich and Forbriger.
mapper.h
Go to the documentation of this file.
1 
35 // include guard
36 #ifndef AFF_MAPPER_H_VERSION
37 
38 #define AFF_MAPPER_H_VERSION \
39  "AFF_MAPPER_H V1.0 "
40 
41 #include<aff/iterator.h>
42 
43 namespace aff {
44 
45  namespace func {
46 
47  namespace util {
48 
65  template<template<class> class C, class F>
66  C<typename F::Toutvalue>
67  mapvalues(const typename C<typename F::Tinvalue>::Tcoc& c,
68  const F& exfun)
69  {
70  typedef typename C<typename F::Tinvalue>::Tcoc Tin;
71  typedef C<typename F::Toutvalue> Tout;
72  Tout retval(c.shape());
73  aff::Browser<Tin> browser(c);
74  aff::Iterator<Tout> iterator(retval);
75  while(browser.valid() && iterator.valid())
76  {
77  *iterator = exfun(*browser);
78  ++browser;
79  ++iterator;
80  }
81  return(retval);
82  }; // mapvalues
83 
84  } // namespace util
85 
86  } // namespace func
87 
88 } // namespace aff
89 
90 #endif // AFF_MAPPER_H_VERSION (includeguard)
91 
92 /* ----- END OF mapper.h ----- */
Root namespace of library.
Definition: array.h:148
Browser.
Definition: iterator.h:139
C< typename F::Toutvalue > mapvalues(const typename C< typename F::Tinvalue >::Tcoc &c, const F &exfun)
Definition: mapper.h:67
Iterator.
Definition: iterator.h:73
bool valid() const
delegate to stepper
Definition: iterator.h:97
Define the iterator class template (prototypes)