deduction guides for
std::ranges::iota_view
|
||||||||||||||||||||||
| Range primitives | |||||||
|
|||||||
| Range concepts | |||||||||||||||||||
|
|||||||||||||||||||
| Range factories | |||||||||
|
|||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||
| Helper items | |||||||||||||||||
|
|
||||||||||||||||
|
定义于头文件
<ranges>
|
||
|
template
<
class
W,
class
Bound
>
requires
(
!
/*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); // 推导 W 和 Bound 为 "long" 类型 assert(io.front() == 1L and io.back() == 6L); }