STL(Standard Template Library) C++の機能 テンプレート、型を指定して関数やクラスを構成する仕組み テンプレートの機能を使ったvectorやmapなど便利な機能の集まり  =ライブラリ vector varr; ↑テンプレートの型指定 template T Add(T a,T b){ return a+b; } int c; c = Add(5, 3); ↑テンプレートの型指定 std::array 固定長配列 std::vector 可変長配列 std::pair ペア std::map 連想配列 ==== std::array ==== std::arrayの使いかた。\\ 基本的にいつもの配列と一緒だよ。\\ ただ、stlの形に合わせてあるから、混乱せずにvectorとかほかのstlのライブラリと同じように使えます\\ 以下、基本事項詰め合わせ(画面小さいときは、Open Replitのボタン押して新しいタブ開いてみてください) {{url>https://replit.com/@youetsusato/STL-arraywotukauyo?v=1&embed=true#main.cpp 700, 600}} ==== std::vector ==== std::arrayの使いかた。\\ これも基本的にいつもの配列と一緒だよ。\\ 以下、基本事項詰め合わせ(画面小さいときは、Open Replitのボタン押して新しいタブ開いてみてください) {{url>https://replit.com/@youetsusato/STL-vectorwotukauyo?v=1&embed=true#main.cpp 700, 600}} === よくあるパティーン::stringのvectorの例 === お題:\\ キーボードからEOF(ctrl+d)が入力されるまで文字列を入力し、入力された文字列を文字列の長さ順に昇順ソートして表示しなさい\\ {{url>https://replit.com/@youetsusato/stringnovector?v=1&embed=true#main.cpp 700, 600}} 実行例: size(first) :0 ada c c++ python cobol visualbasic fortran delph pascal size(after) :9 c, ada, c++, cobol, delph, python, pascal, fortran, visualbasic, ちなみにsortは何も指定しないで、イテレータだけ指定すると、文字列の場合は標準として辞書ソートになります。\\ std::sort(vstr.begin(),vstr.end()); こんな感じ これも覚えておくといいことあるよ。\\