Top/Lang/C++/C++11

目次

C++11 のキーワード (取り敢えず関心のあるものだけ)

スコープ付き列挙型(enum)

アライメントの指定

std::nullptr

参照修飾子

移譲/継承 コンストラクタ

explicit な型変換演算子

ラムダ式

[キャプチャ] (仮引数リスト) -> 戻り値の型 { 関数の中身 };

属性

例外

例外クラスの使い分け

例外を創出しないことを明示する

例外ポインタ

入れ子の例外関連

文字列を数値に変換する

std::stoi() 文字列→ int

int std::stoi( const string& str, size_t* idx = 0, int base = 10 );

std::stol() 文字列→ long

long std::stol( const string& str, size_t* idx = 0, int base = 10 );

std::stoll() 文字列→ long long

long long stoll( const string& str, size_t* idx = 0, int base = 10 );

std::stoull() 文字列→ unsigned long long

unsigned long long stoull( const string& str, size_t* idx = 0, int base = 10 );

std::stof() 文字列→ float

float std::stof( const string& str, size_t* idx = 0 );

std::stod() 文字列→ double

double stod( const string& str, size_t* idx = 0 );

long double stold( const string& str, size_t* idx = 0 );

int std::stoi()

int std::stoi( const wstring& str, size_t* idx = 0, int base = 10 );

long stol( const wstring& str, size_t* idx = 0, int base = 10 );

正規表現での検索

浮動小数点数の入力

日付・時刻

乱数生成

shared_ptr (共有ポインタ)

リソース開放時の処理の指定

std::shared_ptr::get() --- 組み込みポインタの取得

std::shared_ptr<ClassA>    up_a1;
ClassA  *p_a1 = up_a1.get();     // up_a1 が持っている ClassA のリソースを指す組み込みポインタを取得

std::make_shared() --- std::shared_ptr 構築のためのヘルパ関数

unique_ptr

std::move() --- unique_ptr の移動

std::unique_ptr::get() --- 組み込みポインタの取得

std::unique_ptr<ClassX>    up_x1;
ClassX  *p_x1 = up_x1.get();     // up_x1 が持っている ClassX のリソースを指す組み込みポインタを取得

複数の値から、最大値または最小値を選択する

2つの変数を入れ替える

コンパイル時にアサーションを行う

浮動小数点数の四捨五入

数学関数

関数オブジェクトを変数に持つ

時間演算を行う

タプル

システム終了

スレッド

build (clang++/g++)


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS