How can one obtain the sizeof a type for which one has an encoding?
问题 Given an Objective-C type type , one can obtain the encoding encoding and size size of the type easily: const char *encoding = @encode(type); size_t size = sizeof(type); Put a little differently, we have mappings @encode: type_t -> const char * sizeof: type_t -> size_t This raises two questions: (1) Suppose that rather than having a type, we have only an encoding. It would be nice to obtain a mapping sizeofencodedtype: const char * -> size_t such that for every type_t type we have that