Skip to content

Commit

Permalink
added another test file
Browse files Browse the repository at this point in the history
  • Loading branch information
dedeibel committed Jun 24, 2011
1 parent ab08fc3 commit 826de1c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/Transformtest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

#include <string>
#include <sstream>
#include <set>
#include <list>
#include <algorithm>
#include <vector>
#include <functional>
#include <iterator>

#include <ostream> // debug
#include <iostream> // debug

class A {
private:
int mult;

public:
A() : mult(2) {
}
static int trans(int d) {
return 2*d;
}

};

int main(int argc, char **argv) {


std::set<int> d;
d.insert(2);
d.insert(7);
d.insert(8);
d.insert(12);
std::list<int> s;
A a;
std::transform(d.begin(), d.end(), s.begin(), A::trans);

std::copy(s.begin(), s.end(), std::ostream_iterator<int>(std::cout, ", "));
std::cout << std::endl;

return 0;
}

0 comments on commit 826de1c

Please sign in to comment.