数オーバーロードによって、目的の形状 を最小限の入力から定義する方法を提供 • 基準座標(左上、中心、...)をどう区別? • 静的メンバ関数 Rect::FromCenter(...); • tag dispatch Rect{ Center{}, ... }; • enum class Rect{ Rect::Center, ... }; • 新しい型を作る Rect{ Center{ ... }, ... }; 12 struct Rect { int x, y, w, h; // 左上が (0,0), サイズが size explicit Rect(int size); // 左上が (0,0), サイズが w, h Rect(int w, int h); // 左上が x, y, サイズが size Rect(int x, int y, int size); // 左上が x, y, サイズが w, h Rect(int x, int y, int w, int h); // Point 型の値から構築 Rect(Point pos, int size); // Point 型の値から構築 Rect(Point pos, int w, int h);
コンパイラによるコンパイルと、コードの実行結果を 確認できるオンラインコンパイラ Compiler Explorer • 様々なバージョンのコンパイラやコンパイルオプション設定で C++ コード をコンパイルし、そのアセンブリ出力を確認できるオンラインコンパイラ Quick C++ Benchmark • 複数の異なるコードの実行時間を相対的に比較するベンチマーク機能を備え たオンラインコンパイラ。バックエンドは Google Benchmark 32
C++ の言語の進化は加速、 C++14 から C++20 にかけて規格書のページは 495 ページ増 • C++ ライブラリ開発者がユーザの期待や言語の要求水準に応えていくために、 API 設計技法や開発生産性向上に関する議論、知見の共有がますます必要に 41 github.com/Siv3D/OpenSiv3D