#pragma once #include "any.h" #include namespace refl { using UClassPair = std::pair; // 自定义哈希函数 struct UClassPairHash { std::size_t operator()(const UClassPair& pair) const { std::hash ptr_hash; return ptr_hash(pair.first) ^ (ptr_hash(pair.second) << 1); } }; struct UClassPairEqual { bool operator()(const UClassPair& lhs, const UClassPair& rhs) const { return lhs.first == rhs.first && lhs.second == rhs.second; } }; using ConvertFunc = bool (*)(Any& to, const Any& from); using ConvertMap = std::unordered_map; class Convert { protected: static ConvertMap BuildClassMap(); template static bool ConvertTo(Any& to, const Any& from); public: static bool Construct(Any& to,const Any& from); inline static ConvertMap ClassMap = BuildClassMap(); }; }