25 lines
564 B
C++
25 lines
564 B
C++
#include "CCObject.h"
|
|
#include "iostream"
|
|
#include <chrono>
|
|
#include <random>
|
|
|
|
|
|
bool CTL::Object::equals(const Object *other) {
|
|
return this == other; // 默认比较内存地址
|
|
}
|
|
|
|
size_t CTL::Object::hashCode() const noexcept {
|
|
return std::hash<const Object*>{}(this);
|
|
}
|
|
|
|
std::string CTL::Object::toString() const {
|
|
char buffer[64];
|
|
snprintf(buffer, sizeof(buffer), "Object@%p", static_cast<const void*>(this));
|
|
return buffer;
|
|
}
|
|
|
|
std::ostream & CTL::operator<<(std::ostream &os, const Object &map) {
|
|
os << map.toString();
|
|
return os;
|
|
}
|