LLVM: llvm::yaml::MappingContextTraits< T, Context > Struct Template Reference (original) (raw)

This class is similar to MappingTraits but allows you to pass in additional context for each map operation. More...

template<class T, class Context>
struct llvm::yaml::MappingContextTraits< T, Context >

This class is similar to MappingTraits but allows you to pass in additional context for each map operation.

For example:

struct MappingContextTraits<MyStruct, MyContext> { static void mapping(IO &io, MyStruct &s, MyContext &c) { io.mapRequired("name", s.name); io.mapRequired("size", s.size); io.mapOptional("age", s.age); ++c.TimesMapped; } };

Definition at line 85 of file YAMLTraits.h.