C++ type suffix _t, _type or none

后端 未结 4 710
深忆病人
深忆病人 2020-12-29 03:27

C++ sometimes uses the suffix _type on type definitions (e.g. std::vector::value_type), also sometimes _t (e.g. std::si

4条回答
  •  情书的邮戳
    2020-12-29 04:15

    As a C heritage the _t (that used to mean "defined via typedef") syntax has been inherited (they're also SUS/POSIX-reserved in the global namespace).

    Types added in C++ and not present in the original C language (e.g. size_type) don't need to be shortened.

    Keep in mind that to the best of my knowledge this is more of an observation on an established convention rather than a general rule.

提交回复
热议问题