Standard Library Containers with additional optional template parameters?

后端 未结 4 1370
长发绾君心
长发绾君心 2020-11-27 19:51

Having read the claim multiple times in articles - I want to add this question to Stackoverflow, and ask the community - is the following code portable?

temp         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 20:36

    Check subsubsections of 17.4.4 [lib.conforming].

    17.4.4.3/3 says that "a global or non-member function cannot be declared by the implementation as taking additional default arguments", but 17.4.4.4/2 explicitly allows replacing described member function signatures with longer ones so long as the additional parameters have defaults.

    There's no section for templates, though, so if they felt the need to provide 17.4.4.3/3, it seems to me like extra template parameters are allowable barring wording to the contrary.

提交回复
热议问题