AFF --- A container for numbers (array) by Friederich and Forbriger.

◆ mapvalues()

template<template< class > class C, class F >
C<typename F::Toutvalue> aff::func::util::mapvalues ( const typename C< typename F::Tinvalue >::Tcoc &  c,
const F &  exfun 
)

Function template to map values from one container to another

This is a framework to browse through a container and map values to values of a different type. This function template is used by container functions like aff::func::valmap().

Parameters
Cany container class like aff::Array
Fany mapper utility class like aff::func::util::Mapvalmap
ccontainer to read values to be mapped
exfunfully initialized mapper utility
Returns
result container of same shape as c but with mapped values
See also
aff::func::valmap()

Definition at line 67 of file mapper.h.

References aff::Iterator< C >::valid().

Referenced by aff::func::valmap().

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
Browser.
Definition: iterator.h:139
Iterator.
Definition: iterator.h:73
Here is the call graph for this function:
Here is the caller graph for this function: