C++言語
提供:cppreference.com
< cpp
ここは利用可能なC++構造の簡単なリファレンスです。
目次 |
[編集] 一般トピック
[編集] フロー制御
[編集] 条件実行文
与えられた式の値に応じて異なるコードパスが実行されます。
[編集] 繰り返し文
同じコードを複数回実行します。
[編集] ジャンプ文
残されたコードを無視して異なる位置から実行を継続します。
- continue continueを囲っているループ本体の残りの部分をスキップします。
- break breakを囲っているループを終了します。
- goto 別の位置から実行を継続します。
- return returnを囲っている関数の実行を終了します。
[編集] 関数
同じコードをプログラムの異なる部分から再利用できます。
- 関数宣言
- 例外指定子 関数が指定された例外のみスローするか、全くスローしないことを強制する。 ( /deprecated)
- 非例外指定子 どんな例外もスローしないことを強制する。
- インライン指定子 呼び出しコードに関数本体を直接挿入するようコンパイラにヒントを与える。
[編集] 例外
例外は、グローバルエラー変数や関数戻り値を使った方法とくらべ、より堅固なエラー状態通知手段です。
- throw式 signals an error and transfers control to error handler
- try-catchブロック catches exceptions originating from specific block of code
[編集] 名前空間
Namespaces provide a way to prevent name clashes in large projects
[編集] 型
- fundamental types define basic character, integer and floating point types
- compound types define types, holding several members of (potentially) different types
- function types define types, holding a pointer to a function
- decltype specifier defines a type, equivalent to the type of an expression (C++11 feature)
[編集] 指定子
- cv specifiers specifies constness and volatility of a type
- storage duration specifiers specifies storage duration of a type
- constexpr specifier specifies that the value of a variable or function can be computed at compile time (C++11 feature)
- auto specifier specifies that the actual type shall be defined from the expression, assigned to the variable (C++11 feature)
[編集] 演算子
- operators allows using syntax commonly found in mathematics
{{page>/language/template_operator_groups}}
- operator precedence the order in which operators are evaluated
- alternative representations alternative spellings for some of the operators
[編集] ユーティリティ
- standard conversions implicit conversions from one type to another
- explicit conversions explicit conversions from one type to another
- new expression allocates memory dynamically
- delete expression deallocates memory dynamically
- typedef declaration creates a synonym for a type
- type alias declaration creates a synonym for a type
- attributes defines additional information about variable (C++11 feature)
[編集] クラス
Classes provide object-oriented programming concept to C++.
[編集] 特殊メンバ関数
- default constructor initializes the object with default contents
- copy constructor initializes the object with the contents of another object
- move constructor initializes the object with the contents of other, temporary object, minimizing copying overhead (C++11 feature)
- assignment operator replaces the contents of the object with the contents of another object
- move assignment operator replaces the contents of the object with the contents of other, temporary object, minimizing copying overhead (C++11 feature)
- destructor releases claimed resources
[編集] テンプレート
Templates provide a way to apply the same algorithms to different types.

