Is std::vector a `user-defined type`?

后端 未结 4 764
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 04:36

In 17.6.4.2.1/1 and 17.6.4.2.1/2 of the current draft standard restrictions are placed on specializations injected by users into namespace std.

4条回答
  •  醉酒成梦
    2020-12-05 05:09

    The draft standard contrasts fundamental types with user-defined types in a couple of (non-normative) places.

    The draft standard also uses the term "user-defined" in other contexts, referring to entities created by the programmer or defined in the standard library. Examples include user-defined constructor, user-defined operator and user-defined conversion.

    These facts allow us, absent other evidence, to tentatively assume that the intent of the standard is that user-defined type should mean compound type, according to historical usage. Only an explicit clarification in a future standard document can definitely resolve the issue.

    Note that the historical usage is not clear on types like int* or struct foo* or void(*)(struct foo****). They are compound, but should they (or some of them) be considered user-defined?

提交回复
热议问题