std::ranges::iota_view の推論ガイド
From cppreference.com
| ヘッダ <ranges> で定義 |
||
| template< class W, class Bound > (!/*is-integer-like*/<W> || |
(C++20以降) | |
この推論ガイドは、初期値と境界値からの推論を可能にするために、iota_view に対して提供されます。
/*is-integer-like*/ および /*is-signed-integer-like*/ の定義については、is-integer-like を参照してください。
たとえば、views::iota(0, v.size()) のような符号の不一致に起因するバグからガイドが保護されていることに注意してください。この場合、0 は符号付きで、v.size() は符号なしです。
[編集] 例
このコードを実行
#include <cassert> #include <ranges> int main() { auto io = std::ranges::iota_view(1L, 7L); // deduces W and Bound as “long” assert(io.front() == 1L and io.back() == 6L); }