#include #include #include using namespace std; /* int MyMin(int a, int b) { int rv{b}; if (a < b) { rv = a; } return rv; } */ template T MyMin(T a, T b) { T rv{b}; if (a < b) { rv = a; } return rv; } template void DoTest(T a, T b) { cout << "The min of " << a << " and " << b << " is " << MyMin(a,b)< class FooT{ public: FooT(T d): data{d} {}; T Data() const{ return data; } bool operator < ( const FooT & other) { return data < other.data; }; private: T data; }; template ostream & operator << (ostream & s , const FooT & target) { s << "FooT.Data("<< target.Data() << ")"; return s; } /* bool operator < (const FooT & a, const FooT & b) { return a.Data() < b.Data(); } */ int main() { string a{"hello"}; string b{"world"}; ofstream file{"OutputFile.txt.dat.windows.sucks"}; DoTest(4,5); DoTest(a,b); FooT w{7},x{9}; FooT y{"hello"},z{"World"}; DoTest(w,x); DoTest(y,z); cout << "The smallest of the two is " << MyMin(w,x).Data() << endl; cout << "The smallest of the two is " << MyMin(y,z).Data() << endl; // file << w << endl; DoTest(9.14, 7); return 0; }