跳到主要内容

标点

这些是 C++ 中的标点符号。每个符号的含义在链接的页面中详述。

{}

[]

#

##

()

;

  • 指示以下构造的末尾
  • 分隔for 语句的第二与第三子句。

:

...

  • 函数声明符或 lambda 表达式(C++11 起)或用户定义推导指引(C++17 起)中形参列表的一部分,标识变参数函数
  • catch 子句中标识万应处理。
  • 宏定义中标识变参数宏。(C++11 起)
  • 指示声明与展开。(C++11 起)

?

::

.

.*

->

->*

~

!

+

-

*

/

%

^

&

|

=

+=

-=

*=

/=

%=

^=

&=

|=

==

!=

<

>

<=

>=

<=>(C++20 起)

&&

||

<<

>>

<<=

>>=

++

--

,

引用

  • C++20 标准(ISO/IEC 14882:2020):
    • 5.12 Operators and punctuators [lex.operators]
  • C++17 标准(ISO/IEC 14882:2017):
    • 5.12 Operators and punctuators [lex.operators]
  • C++14 标准(ISO/IEC 14882:2014):
    • 2.13 Operators and punctuators [lex.operators]
  • C++11 标准(ISO/IEC 14882:2011):
    • 2.13 Operators and punctuators [lex.operators]
  • C++03 标准(ISO/IEC 14882:2003):
    • 2.12 Operators and punctuators [lex.operators]
  • C++98 标准(ISO/IEC 14882:1998):
    • 2.12 Operators and punctuators [lex.operators]

参阅