a.cc

Wizmann C/C++ 2/17/2017 6:48:43 AM +00:00

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>

using namespace std;

#define print(x) cout << x << endl
#define input(x) cin >> x

const int SIZE = 12345;
const int INF = 0x3f3f3f3f;

template<typename T>
const T& mymax(const T& a, const T& b) {
    return a > b? a: b;
}

class MyInt {
public:
    MyInt(int value_): value(value_) {
        // pass
    }

    bool operator == (const MyInt& other) const {
        return value == other.value;
    }

    bool operator > (const MyInt& other) const {
        return value > other.value;
    }
private:
    int value;
};

int main() {
    assert(mymax(1, 2) == 2);
    assert(mymax(1.0, 2.0) == 2.0);
    assert(mymax('a', 'b') == 'b');
    assert(mymax(string("this"), string("that")) == "this");
    assert(mymax(MyInt(1), MyInt(2)) == MyInt(2));
    return 0;
}