23 рядки
449 B
C++
23 рядки
449 B
C++
#include <algorithm>
|
|
#include <memory>
|
|
#include <iostream>
|
|
|
|
class C {
|
|
public:
|
|
int valid;
|
|
C() : valid(1) { }
|
|
~C() { valid = 0; }
|
|
};
|
|
|
|
/* some "random" comparison, doesn't matter */
|
|
bool operator<(C const& a, C const& b) {
|
|
return reinterpret_cast<uintptr_t>(&a) < reinterpret_cast<uintptr_t>(&b);
|
|
}
|
|
|
|
int main() {
|
|
auto const& m =
|
|
// std::max(*std::make_shared<C>(), *std::make_shared<C>());
|
|
std::max(C(), C());
|
|
std::cout << m.valid << "\n";
|
|
}
|