Adding types to the std namespace

后端 未结 7 838
孤城傲影
孤城傲影 2020-11-28 15:34

Is it acceptable to add types to the std namespace. For example, I want a TCHAR-friendly string, so is the following acceptable?

#include 

        
7条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 16:23

    Officially, the standard says that's "undefined behaviour", and all kinds of nasty things can happen.

    In practice, it will work fine, but you still shouldn't do it. What does it buy you, other than confusing people that something is provided by the compiler?

提交回复
热议问题