メインコンテンツへスキップ
見出し画像

C++14

    WIP

    1. 言語機能 (Core Language Features)


    【関数・型推論】

    • 通常関数の戻り値型推論 (auto f() { return x; })

    • ジェネリックラムダ式 ([](auto x) { ... })

    • 初期化付きラムダキャプチャ (init-capture / 一般化ラムダキャプチャ: x = [std::move(y)] { ... })

    • decltype(auto)

    【テンプレート】

    • 変数テンプレート (template<class T> constexpr T pi = T(3.1415926535...);)

    【定数式 (constexpr)】

    • constexpr関数の制約大幅緩和:

      • 複数文の記述許可

      • ローカル変数の宣言・変更

      • if文、switch文などの分岐処理

      • for文、while文、do-while文などのループ処理

      • void戻り値の許可

    【リテラル】

    • 2進数リテラル (プレフィックス 0b / 0B: 例 0b1010'0101)

    • 桁区切り文字 (シングルクォート ': 例 1'000'000, 0b1010'0101)

    【属性 (Attributes)】

    • [[deprecated]] / [[deprecated("reason")]] 属性

    【その他】

    • メモリアロケーションのサイズ付き解放 (Sized deallocation)

    2. 標準ライブラリ: 追加関数・関数テンプレート


    【メモリ管理 (<memory>)】

    • std::make_unique

    【タプル (<tuple>)】

    • std::get<T>(tuple) (型によるtuple要素の取得)

    【ユーティリティ・インデックスシーケンス (<utility>)】

    • std::make_integer_sequence

    • std::make_index_sequence

    • std::index_sequence_for

    • std::exchange

    【イテレータ操作 (<iterator>)】

    • std::cbegin

    • std::cend

    • std::rbegin

    • std::rend

    • std::crbegin

    • std::crend

    【アルゴリズム (<algorithm>)】

    • std::equal (4つのイテレータを受け取るオーバーロード)

    • std::mismatch (4つのイテレータを受け取るオーバーロード)

    • std::is_permutation (4つのイテレータを受け取るオーバーロード)

    【数値アルゴリズム (<numeric>)】

    • 既存のアルゴリズム (std::accumulate, std::inner_product, std::partial_sum, std::adjacent_difference) へのconstexpr修飾付与

    【I/Oマニピュレータ (<iomanip>)】

    • std::quoted (引用符付き文字列の入出力)

    【関数オブジェクト (<functional>)】

    • std::equal_to<> (void特殊化・透明な比較関数)

    • std::not_equal_to<>

    • std::greater<>

    • std::less<>

    • std::greater_equal<>

    • std::less_equal<>

    • std::logical_and<>

    • std::logical_or<>

    • std::logical_not<>

    • std::plus<>

    • std::minus<>

    • std::multiplies<>

    • std::divides<>

    • std::modulus<>

    • std::negate<>

    • std::bit_and<>

    • std::bit_or<>

    • std::bit_xor<>

    • std::bit_not<>

    3. 標準ライブラリ: 追加クラス・型・エイリアス


    【スレッド・同期 (<shared_mutex>)】

    • std::shared_timed_mutex

    • std::shared_lock

    【インデックスシーケンス (<utility>)】

    • std::integer_sequence

    • std::index_sequence

    【型特性の別名テンプレート (Type Traits _t aliases, <type_traits>)】

    • std::decay_t

    • std::remove_reference_t

    • std::remove_pointer_t

    • std::add_pointer_t

    • std::remove_const_t

    • std::remove_volatile_t

    • std::remove_cv_t

    • std::add_const_t

    • std::add_volatile_t

    • std::add_cv_t

    • std::remove_extent_t

    • std::remove_all_extents_t

    • std::add_lvalue_reference_t

    • std::add_rvalue_reference_t

    • std::make_signed_t

    • std::make_unsigned_t

    • std::aligned_storage_t

    • std::aligned_union_t

    • std::underlying_type_t

    • std::enable_if_t

    • std::conditional_t

    • std::common_type_t

    • std::result_of_t

    【型判定】

    • std::is_null_pointer⁠(⁠<type_traits>⁠ ヘッダ)

    【ユーザー定義リテラル演算子 (User-Defined Literals)】

    • std::string 用リテラル (<string>):

      • ""s (std::string オブジェクトの生成)

    • std::chrono 用リテラル (<chrono>):

      • ""h (hours)

      • ""min (minutes)

      • ""s (seconds)

      • ""ms (milliseconds)

      • ""us (microseconds)

      • ""ns (nanoseconds)

    • 複素数用リテラル (<complex>):

      • ""il (long double)

      • ""i (double)

      • ""if (float)


    参照:

    #C #cpp #cpp14 #programming #tutorial#modern #study #STL #std #lib

     

    遊月

     
     
    うつ回復期✨社会恐怖症。 SESなエンジニア (元ゲームPG) 日々学習、プログラミング、アニメゲーム、ドール、天然石が好き。 日記を中心に様々な情報をお届け。生成AIで遊んでます。 🗒️'20/6/8~

    あなたへのおすすめ