Commit 336ea2a6 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

works fine now

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1687
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 8c0fcb4e
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: README.changelog,v 1.51 2005-04-28 11:38:04 tforb Exp $
* $Id: README.changelog,v 1.52 2005-04-28 13:55:56 tforb Exp $
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
......@@ -21,7 +21,7 @@
/*! \page page_changelog ChangeLog (AFF)
$Id: README.changelog,v 1.51 2005-04-28 11:38:04 tforb Exp $
$Id: README.changelog,v 1.52 2005-04-28 13:55:56 tforb Exp $
\sa \ref page_project_status
......@@ -221,7 +221,7 @@
/*! \page page_project_status Project status (AFF)
$Id: README.changelog,v 1.51 2005-04-28 11:38:04 tforb Exp $
$Id: README.changelog,v 1.52 2005-04-28 13:55:56 tforb Exp $
\sa \ref page_changelog
......@@ -388,10 +388,10 @@
<TD>21/04/2005</TD><TD>21/04/2005</TD><TD>21/04/2005</TD><TD> </TD>
</TR>
<TR><TD>libaff/functions/rms.h</TD>
<TD>21/04/2005</TD><TD>21/04/2005</TD><TD></TD><TD> </TD>
<TD>21/04/2005</TD><TD>21/04/2005</TD><TD>28/04/2005</TD><TD> </TD>
</TR>
<TR><TD>libaff/functions/valmap.h</TD>
<TD></TD><TD></TD><TD></TD><TD> </TD>
<TD>28/04/2005</TD><TD>28/04/2005</TD><TD>28/04/2005</TD><TD> </TD>
</TR>
<TR><TD><BR><B>tests and examples</B></TD></TR>
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: valmap.h,v 1.2 2005-04-28 12:58:31 tforb Exp $
* $Id: valmap.h,v 1.3 2005-04-28 13:55:56 tforb Exp $
* \author Thomas Forbriger
* \date 20/03/2005
*
......@@ -23,7 +23,7 @@
#define AFF_VALMAP_H_VERSION \
"AFF_VALMAP_H V1.0 "
#define AFF_VALMAP_H_CVSID \
"$Id: valmap.h,v 1.2 2005-04-28 12:58:31 tforb Exp $"
"$Id: valmap.h,v 1.3 2005-04-28 13:55:56 tforb Exp $"
#include<aff/lib/mapper.h>
#include<map>
......@@ -64,19 +64,21 @@ namespace aff {
* type
*
* \param C any container class like aff::Array
* \param T1 type of values in source container
* \param T2 type of values in target container
* \param M a std::map that defines source and target type
*
* \param c any container of values to be mapped
* \return container of same shape as c but with mapped values
*
* \sa aff::func::util::mapvaues, aff::func::util::Mapvalmap
*/
template<template <class> class C, class T1, class T2>
C<T2> valmap(const C<T1>& c,
const typename util::Mapvalmap<T1,T2>::Tmap& m)
template<template <class> class C, class M>
C<typename M::mapped_type> valmap(const C<typename M::key_type>& c,
const M& m)
{
return(aff::func::util::mapvalues<C, util::Mapvalmap<T1,T2> >(c,m));
typedef typename M::key_type Tinvalue;
typedef typename M::mapped_type Toutvalue;
return(aff::func::util::mapvalues<C,
util::Mapvalmap<Tinvalue,Toutvalue> >(c,m));
} // rms()
} // namespace func
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: functionstest.cc,v 1.6 2005-04-28 12:58:31 tforb Exp $
* $Id: functionstest.cc,v 1.7 2005-04-28 13:55:56 tforb Exp $
* \author Thomas Forbriger
* \date 20/03/2005
*
......@@ -19,7 +19,7 @@
#define FUNCTIONSTEST_VERSION \
"FUNCTIONSTEST V1.0 test function templates"
#define FUNCTIONSTEST_CVSID \
"$Id: functionstest.cc,v 1.6 2005-04-28 12:58:31 tforb Exp $"
"$Id: functionstest.cc,v 1.7 2005-04-28 13:55:56 tforb Exp $"
#include <iostream>
#include <aff/dump.h>
......@@ -64,7 +64,8 @@ int main(int iargc, char* argv[])
CODE( avalmap[1.]=2 );
CODE( avalmap[2.]=3 );
CODE( avalmap[5.]=4 );
CODE( dump_array(aff::func::valmap<aff::Array, double, int>(A, avalmap)) );
CODE( aff::Array<Tvalmap::mapped_type> B=aff::func::valmap(A, avalmap) );
CODE( dump_array(B) );
}
/* ----- END OF functionstest.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment