キーワード 編集

C++のキーワードは次のとおりです[1]

  • alignas
  • alignof
  • asm
  • auto
  • bool
  • break
  • case
  • catch
  • char
  • char16_t
  • char32_t
  • char8_t
  • class
  • co_await
  • co_return
  • co_yield
  • concept
  • const
  • const_cast
  • consteval
  • constexpr
  • constinit
  • continue
  • decltype
  • default
  • delete
  • do
  • double
  • dynamic_cast
  • else
  • enum
  • explicit
  • export
  • extern
  • false
  • float
  • for
  • friend
  • goto
  • if
  • inline
  • int
  • long
  • mutable
  • namespace
  • new
  • noexcept
  • nullptr
  • operator
  • private
  • protected
  • public
  • register[2]
  • reinterpret_cast
  • requires
  • return
  • short
  • signed
  • sizeof
  • static
  • static_assert
  • static_cast
  • struct
  • switch
  • template
  • this
  • thread_local
  • throw
  • true
  • try
  • typedef
  • typeid
  • typename
  • union
  • unsigned
  • using
  • virtual
  • void
  • volatile
  • wchar_t
  • while

これに加え、モジュールに関する export import module も構文要素 keyword: の一部を構成する。

演算子の代替表現もキーワードに準じた扱いとなります[1]

  • and
  • and_eq
  • bitand
  • bitor
  • compl
  • not
  • not_eq
  • or
  • or_eq
  • xor
  • xor_eq

脚注 編集

  1. ^ 1.0 1.1 Working Draft, Standard for Programming Language C++, Document Number: N4885, Date: 2021-03-17 :: §5.11 Keywords P-18
  2. ^ registerキーワードは未使用ですが、将来の使用のために予約されています。