cppannotations/yo/stl/examples/plus.cc
Frank B. Brokken 688cd5ed42 STL: WIP
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@350 f6dd340e-d3f9-0310-b409-bdd246841980
2009-12-24 15:25:29 +00:00

21 lines
536 B
C++

#include <iostream>
#include <string>
#include <functional>
using namespace std;
int main(int argc, char **argv)
{
plus<size_t> uAdd; // function object to add size_ts
cout << "3 + 5 = " << uAdd(3, 5) << '\n';
plus<string> sAdd; // function object to add strings
cout << "argv[0] + argv[1] = " << sAdd(argv[0], argv[1]) << '\n';
}
/*
Output when called as: a.out going
3 + 5 = 8
argv[0] + argv[1] = a.outgoing
*/