C++ 在哪里可以找到C++;11类型前缀/后缀?

C++ 在哪里可以找到C++;11类型前缀/后缀?,c++,types,c++11,prefix,user-defined-literals,C++,Types,C++11,Prefix,User Defined Literals,有人能给我指一下语言类型前缀/后缀的完整列表吗 前缀示例: auto s1 (u8"I'm a UTF-8 string."); auto s2 (u"This is a UTF-16 string."); auto s3 (U"This is a UTF-32 string."); auto s4 (R"(RAW \ STRING " )"); auto s5 (L"wide string"); //etc.. //*I've only seen prefixes like this for

有人能给我指一下语言类型前缀/后缀的完整列表吗

前缀示例:

auto s1 (u8"I'm a UTF-8 string.");
auto s2 (u"This is a UTF-16 string.");
auto s3 (U"This is a UTF-32 string.");
auto s4 (R"(RAW \ STRING " )");
auto s5 (L"wide string");
//etc..
//*I've only seen prefixes like this for strings.
auto n1 = 7.2f;
auto n2 = 7.2d;
auto n3 = 100L;
auto n4 = 10000LL;
//etc..
后缀示例:

auto s1 (u8"I'm a UTF-8 string.");
auto s2 (u"This is a UTF-16 string.");
auto s3 (U"This is a UTF-32 string.");
auto s4 (R"(RAW \ STRING " )");
auto s5 (L"wide string");
//etc..
//*I've only seen prefixes like this for strings.
auto n1 = 7.2f;
auto n2 = 7.2d;
auto n3 = 100L;
auto n4 = 10000LL;
//etc..
我所有的搜索尝试都会将我发送到“生成您自己的用户定义文字”。
也许这些实例有一个我不知道的特定名称

这些不是“类型”前缀/后缀,而是文字前缀/后缀,因为它们应用于文字(字符串文字、数字文字等)。它们没有具体的名字,因为它们没有那么有趣☺.

C++11中的内置前缀和后缀是:

  • 整数:

    • 12U
      12L
      12UL
      12LU
      12LL
      12LLU
      12UL
      12UL
      12LU
      12ULL
      12L
      12UL,
      12ul
      12lu
      12ull
      12llu
  • 浮点数:

    • 1.0f
      1.0f
      1.0l
      1.0l
  • 人物:

    • L'x'
      u'x'
      u'x'
  • 字符串:

    • u8“xxx”
      u“xxx”
      u“xxx”
      L“xxx”
      R”(xxx)
      u8R”(xxx)
      uR”(xxx)
      uR”(xxx)
      LR”(xxx)
特别是,
1.0d
不是内置的C++11后缀。某些编译器(如GCC)可能还具有其他数字后缀的扩展,请参阅


相关词汇语法:

(§2.14.2整数文字)

无符号后缀:其中一个

u

长后缀:其中一个

l

长后缀:其中一个

ll-ll

(§2.14.4浮动文字)

浮动后缀:其中一个

fl

(§2.14.3字符文字)

字符文字:

'
c-char-sequence
'

u'
c-char-sequence
'

U'
c-char-sequence
'

L'
c-char-sequence
'

(§2.14.5字符串文字)

字符串文字:

编码前缀
s-char-sequenceopt

编码前缀
R
原始字符串

编码前缀:

u8

u

U

L


提到用户定义的文字会很好。@LucDanton:我相信OP已经知道什么是用户定义的文字(他/她在最后一段的第二段提到过),所以我就不提了。如果其他人对更广义的文字感兴趣,并且通过搜索偶然发现了这个问题怎么办?