Namespaces
Variants

C++ keywords

From cppreference.net
C++ language
General topics
Flow control
Conditional execution statements
Iteration statements (loops)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications ( until C++17* )
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
Miscellaneous

C++の予約キーワードの一覧です。これらは言語によって使用されているため、再定義やオーバーロードはできません。 例外として、 属性 (属性引数リストを除く)内では予約語とは見なされません。 (C++11以降)

このHTMLコードはC++のキーワード一覧を表示するテーブルセルです。すべてのC++キーワードは` `タグ内にあり、翻訳対象外として保持されています。バージョン情報(C++11、C++20など)もそのまま保持されています。
A – C D – P R – Z

alignas (C++11)
alignof (C++11)
and
and_eq
asm
atomic_cancel (TM TS)
atomic_commit (TM TS)
atomic_noexcept (TM TS)
auto (1) (3) (4) (5)
bitand
bitor
bool
break
case
catch
char
char8_t (C++20)
char16_t (C++11)
char32_t (C++11)
class (1)
compl
concept (C++20)
const
consteval (C++20) (5)
constexpr (C++11) (3)
constinit (C++20)
const_cast
continue
contract_assert (C++26)
co_await (C++20)
co_return (C++20)
co_yield (C++20)

decltype (C++11) (2)
default (1)
delete (1)
do
double
dynamic_cast
else
enum (1)
explicit
export (1) (4)
extern (1)
false
float
for (1)
friend
goto
if (3) (5)
inline (1) (3)
int (1)
long
mutable (1)
namespace
new
noexcept (C++11)
not
not_eq
nullptr (C++11)
operator (1)
or
or_eq
private (4)
protected
public

reflexpr (リフレクションTS)
register (3)
reinterpret_cast
requires (C++20)
return
short
signed
sizeof (1)
static
static_assert (C++11)
static_cast
struct (1)
switch
synchronized (TM TS)
template
this (5)
thread_local (C++11)
throw (3) (4)
true
try
typedef
typeid
typename (3) (4)
union
unsigned
using (1) (4)
virtual
void
volatile
wchar_t
while
xor
xor_eq

  • (1) — C++11で意味が変更または新しい意味が追加されたもの。
  • (2) — C++14で新しい意味が追加されたもの。
  • (3) — C++17で意味が変更または新しい意味が追加されたもの。
  • (4) — C++20で意味が変更または新しい意味が追加されたもの。
  • (5) — C++23で新しい意味が追加されたもの。

以下の点に注意してください: and bitor or xor compl bitand and_eq or_eq xor_eq not および not_eq (さらに二重字: < % % > < : : > % : % : % : および三重字: ?? < ?? > ?? ( ?? ) ?? = ?? / ?? ' ?? ! ?? - (C++17まで) )は、 標準トークンを表現する代替手段 を提供します。 これらのキーワードは属性内(属性引数リストを除く)でも予約語と見なされますが、一部の実装では他のキーワードと同様に扱われます。 (C++11以降)

キーワードに加えて、 特別な意味を持つ識別子 があり、これらはオブジェクトや関数の名前として使用できますが、特定の文脈では特別な意味を持ちます。

final (C++11)
override (C++11)
transaction_safe (TM TS)
transaction_safe_dynamic (TM TS)
import (C++20)
module (C++20)
pre (C++26)
post (C++26)
trivially_relocatable_if_eligible (C++26)
replaceable_if_eligible (C++26)

また、任意の位置に二重アンダースコア __ を含むすべての identifier および、アンダースコアの後に大文字が続く識別子は常に予約されており、アンダースコアで始まるすべての識別子はグローバル名前空間での名前として使用するために予約されています。詳細は identifier を参照してください。

std 名前空間は、標準C++ライブラリの名前を配置するために使用されます。これに名前を追加するための規則については、 Extending namespace std を参照してください。

posix という名前は将来のトップレベル名前空間のために予約されています。プログラムがその名前空間内で何かを宣言または定義する場合、動作は未定義です。

(C++11以降)

以下のトークンは、プリプロセッサディレクティブのコンテキスト内で preprocessor によって認識されます:

if
elif
else
endif

ifdef
ifndef
elifdef (C++23)
elifndef (C++23)
define
undef

include
embed (C++26)
line

error
warning (C++23)
pragma

defined
__has_include (C++17)
__has_cpp_attribute (C++20)
__has_embed (C++26)

export (C++20)
import (C++20)
module (C++20)

以下のトークンは、プリプロセッサディレクティブの 外部 コンテキストにおいて preprocessor によって認識されます:

_Pragma (C++11)

**日本語訳:**

_Pragma (C++11)

**説明:** - `_Pragma` はC++のプリプロセッサ演算子であり、C++固有の用語のため翻訳対象外 - `(C++11)` は言語仕様のバージョンを示す標準表記のため翻訳対象外 - HTMLタグ、属性、コードタグ内のテキストはすべて原文のまま保持

関連項目