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

后端 未结 4 765
没有蜡笔的小新
没有蜡笔的小新 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条回答
  •  旧时难觅i
    2020-12-05 05:06

    Prof. Stroustrup is very clear that any type that is not built-in is user-defined. See the second paragraph of section 9.1 in Programming Principles and Practice Using C++.

    He even specifically calls out “standard library types” as an example of user-defined types. In other words, a user-defined type is any compound type.

    Source

    The article explicitly mentions that not everyone seems to agree, but this is IMHO mostly wishful thinking and not what the standard (and Prof. Stroustrup) are actually saying, only what some people want to read into it.

提交回复
热议问题