Factory/CCObject.cpp

25 lines
564 B
C++
Raw Normal View History

2025-12-06 17:11:34 +08:00
#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;
}