#pragma once #include #include "convert.h" namespace refl { inline bool Convert::ToString(Any& dst, const Any& src) { if (src.Parent() == &TypeInfo::StaticClass) { std::construct_at(dst.CastTo(), src.CastTo()); return true; } return false; } inline bool Convert::Construct(Any& dst, const Any& src) { if (dst.Check(src.cls)) { dst.cls->parent->InitObject((void*)dst.ptr); dst.cls->parent->CopyObject((void*)dst.ptr, src.ptr); return true; } auto it = ClassMap.find(dst.cls); if (it == ClassMap.end()) { return false; } return it->second(dst, src); } inline ConvertMap Convert::BuildClassMap() { ConvertMap classMap; classMap.emplace(&TypeInfo::StaticClass, &ToString); return classMap; } }