-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfopow.cpp
More file actions
38 lines (30 loc) · 722 Bytes
/
fopow.cpp
File metadata and controls
38 lines (30 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <functional>
#include <cmath>
#include <iterator>
#include <sequtils.h>
using namespace std;
template <class T1, class T2>
struct fopow : public std::binary_function<T1,T2,T1>
{
T1 operator() (T1 base, T1 exp) const {
return std::pow(base,exp);
}
};
int main(int argc, char *argv[])
{
vector<int> col1;
populate_lseq(col1, 9);
transform(col1.begin(), col1.end(),
ostream_iterator<int>(cout, " "),
bind1st(fopow<float, int>(), 3));
cout << endl;
transform(col1.begin(), col1.end(),
ostream_iterator<int>(cout, " "),
bind2nd(fopow<float, int>(), 3));
cout << std::endl;
return 0;
}