18. 总算添加了Unicode⽀支持!
u8"I'm a UTF-8 string."
u"This is a UTF-16 string."
U"This is a UTF-32 string."
u8"This is a Unicode Character: u2018."
u"This is a bigger Unicode Character: u2018."
U"This is a Unicode Character: U00002018."
u8R"XXX(I'm a"raw UTF-8" string.)XXX"
uR"*(This is a "raw UTF-16" string.)*"
UR"(This is a "raw UTF-32"string.)"
36. 新增关键字static_assert!
⽤用于编译时排错
static_assert((GREEKPI > 3.14) && (GREEKPI < 3.15), "GREEKPI is
inaccurate!”);
!
//类级:
template<class T>
struct Check {
static_assert(sizeof(int) <= sizeof(T), "T is not big enough!");
};
!
//⽅方法级:
template<class Integral>
Integral foo(Integral x, Integral y) {
static_assert(std::is_integral<Integral>::value, "foo() parameter must
be an integral type.");
}