ECF 1.5
Mul.h
1#ifndef ECF_CARTESIAN_MUL_H
2#define ECF_CARTESIAN_MUL_H
3#include "Function.h"
4namespace cartesian{
5 template <typename Container, typename Result>
6 class Mul : public Function<Container,Result> {
7 public:
8 Mul();
9 ~Mul(){};
10 void evaluate(Container& container, Result& result);
11 };
12
13 template <typename Container, typename Result>
15 {
16 this->name_ = "*";
17 this->numOfArgs_ = 2;
18 }
19
20 template <typename Container, typename Result>
21 void Mul<Container,Result>::evaluate(Container& container, Result& result)
22 {
23 result = 1.0;
24 for(typename Container::iterator it = container.begin(); it != container.begin() + this->numOfArgs_; it++) {
25 result *= *it;
26 }
27 }
28}
29#endif //ECF_CARTESIAN_MUL_H
void evaluate(Container &container, Result &result)
Definition: Mul.h:21