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

前端 未结 5 1517
醉梦人生
醉梦人生 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:06

    C++ compilers generally expect the command line option -std=c++11 (or -std=c++0x for slightly older ones, respectively) to activate C++11-support.

    not supporting C++11 style at all.

    No, it perfectly does. GCC 4.7.2's support can be checked here. To activate some experimental features, pass -std=gnu++11.

    And Clang 3.4 actually supports pretty much everything in C++11 and already much out of C++1y.

提交回复
热议问题