코드 4-8 기본적인 리플렉션 시스템
enum EPrimitiveType { EPT_Int, EPT_String, EPT_Float }; class MemberVariable { public: MemberVariable(const char* inName, EPrimitiveType inPrimitiveType, uint32_t inOffset) : mName(inName), mPrimitiveType(inPrimitiveType), mOffset(inOffset) { } EPrimitiveType GetPrimitiveType() const { return mPrimitiveType; } uint32_t GetOffset() const { return mOffset; } private: std::string mName; EPrimitiveType mPrimitiveType; uint32_t mOffset; }; class DataType { public: DataType(std::initializer_list<const MemberVariable&> inMVs) : mMemberVariables(inMVs) { } const std::vector<MemberVariable>& GetMemberVariables() const { return mMemberVariables; } private: std::vector<MemberVariable> mMemberVariables; };