1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

Functions can act on maps

This commit is contained in:
Antonin Portelli 2019-03-09 22:44:57 +00:00
parent 6addec5e14
commit be14739695
2 changed files with 15 additions and 0 deletions

View File

@ -111,6 +111,20 @@ double DoubleFunction::operator()(void) const
return (*this)(nullptr);
}
std::map<double, double> DoubleFunction::operator()(const std::map<double, double> &m) const
{
checkSize(1);
std::map<double, double> res;
for (auto &val: m)
{
res[val.first] = (*this)(val.second);
}
return res;
}
// bind ////////////////////////////////////////////////////////////////////////
DoubleFunction DoubleFunction::bind(const Index argIndex,
const double val) const

View File

@ -52,6 +52,7 @@ public:
double operator()(void) const;
template <typename... Ts>
double operator()(const double arg0, const Ts... args) const;
std::map<double, double> operator()(const std::map<double, double> &m) const;
// bind
DoubleFunction bind(const Index argIndex, const double val) const;
DoubleFunction bind(const Index argIndex, const DVec &x) const;