You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
449 B

#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";
}