How can I create a new primitive type using C++11 style strong typedefs?

前端 未结 5 1534
醉梦人生
醉梦人生 2020-12-15 20:55

I\'m trying to emulate in C++ a distinct type from the Nim programming language. The following example won\'t compile in Nim because the compiler catches the variables

5条回答
  •  孤街浪徒
    2020-12-15 21:05

    There are no strong typedefs in C++11. There is support for units with but that is a totally different thing. Nobody can agree on what behaviour strong typedefs should have, exactly, so there has never been a proposal for them that got anywhere, so not only are they in neither C++11 nor C++14, there is no realistic prospect at this time that they will get into any future Standard.

提交回复
热议问题