Standard Library Containers with additional optional template parameters?

后端 未结 4 1349
长发绾君心
长发绾君心 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:39

    I found the following issue report, which says

    There is no ambiguity; the standard is clear as written. Library implementors are not permitted to add template parameters to standard library classes. This does not fall under the "as if" rule, so it would be permitted only if the standard gave explicit license for implementors to do this. This would require a change in the standard.

    The LWG decided against making this change, because it would break user code involving template template parameters or specializations of standard library class templates.

    The books and people that say an implementation may add other optional parameters seem to be wrong.

提交回复
热议问题