Expression tuples cannot be used for indexing built-in arrays: -------------------- import std.typetuple; void main() { alias TypeTuple!(1) index; auto arr = new int[4]; auto x = arr[index]; // error } -------------------- % dmd -o- -c test test.d(6): Error: cannot implicitly convert expression (tuple(1)) of type (int) to uint -------------------- While overloaded opIndex accepts expression tuple. -------------------- import std.typetuple; void main() { alias TypeTuple!(1) index; S s; auto x = s[index]; // okay } struct S { size_t opIndex(size_t i) { return i; } } --------------------
https://github.com/D-Programming-Language/dmd/pull/105
https://github.com/9rnsr/dmd/commit/0238f964842a736b87a6db1af4f60f6ef23ebdb1 https://github.com/D-Programming-Language/dmd/commit/f246e65e03c5e2102d92b176550e3fb28ef65d15 https://github.com/D-Programming-Language/dmd/commit/5b542c0332fd0ac803c7592b09c0d1bd9c2a512d
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル