ned version of the argument type.

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/iota_view&action=edit&section=4 "Edit
section: Deduction guides") ]  Deduction guides

template  < class  W,  class  Bound  >  
requires  (  !  /* is-integer-like */  < W  >  
||  !  /* is-integer-like */  < Bound  >  
||  /* is-signed-integer-like */  < W  >  
==  /* is-signed-integer-like */  < Bound  > )  
iota_view  (  W, Bound  )  \-  > iota_view  < W, Bound  > ;  |  |  (since C++20)   
---|---|---  
|  |   
  
For any type ` T ` ,  /* is-integer-like */  < T  > is  true  if and only if `
T ` is [ integer-like ](/w/cpp/iterator/weakly_incrementable#Integer-
like_types "cpp/iterator/weakly incrementable") , and  /* is-signed-integer-
like */  < T  > is  true  if and only if ` T ` is integer-like and capable of
representing negative values.

Note that the guide protects itself against signed/unsigned mismatch bugs,
like  views  ::  iota  (  0  , v.  size  (  )  )  , where  ​  0  ​  is a
(signed)  int  and  v.  size  (  )  is an (unsigned)  [ std::size_t
](/w/cpp/types/size_t "cpp/types/size t") .

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/iota_view&action=edit&section=5 "Edit
section: Nested classes") ]  Nested classes

[ _ iterator  _ ](/w/cpp/ranges/iota_view/iterator "cpp/ranges/iota view/iterator") (C++20)  |  the iterator type   
(  exposition-only member class*  )  
---|---  
[ _ sentinel  _ ](/w/cpp/ranges/iota_view/sentinel "cpp/ranges/iota view/sentinel") (C++20)  |  the sentinel type used when the  ` iota_view ` is bounded and ` Bound ` and ` W ` are not the same type   
(  exposition-only member class*  )  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/iota_view&action=edit&section=6 "Edit
section: Helper templates") ]  Helper templates

template  < [ std::  weakly_incrementable
](http://en.cppreference.com/w/cpp/iterator/weakly_incrementable) W, [ std::
semiregular  ](http://en.cppreference.com/w/cpp/concepts/semiregular) Bound  >  
inline  constexpr  bool  enable_borrowed_range  < ranges  ::  iota_view  < W, Bound  >> =  true  ;  |  |  (since C++20)   
---|---|---  
|  |   
  
This specialization of [ ` std::ranges::enable_borrowed_range `
](/w/cpp/ranges/borrowed_range "cpp/ranges/borrowed range") makes  ` iota_view
` satisfy [ ` borrowed_range ` ](/w/cpp/ranges/borrowed_range
"cpp/ranges/borrowed range") .

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/iota_view&action=edit&section=7 "Edit
section: Example") ]  Example

Run this code

    
    
    #include <algorithm>
    #include <iostream>
    #include <ranges>
     
    struct Bound
    {
        int bound;
        bool operator==(int x) const { return x == bound; }
    };
     
    int main()
    {
        for (int i : std::ranges::iota_view{1, 10})
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        for (int i : std::views::iota(1, 10))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        for (int i : std::views::iota(1, Bound{10}))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        for (int i : std::views::iota(1) | std::[views::take](http://en.cppreference.com/w/cpp/ranges/take_view)(9))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        std::[ranges::for_each](http://en.cppreference.com/w/cpp/algorithm/ranges/for_each)(std::views::iota(1, 10), [](int i)
        {
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        });
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
    }

Output:

    
    
    1 2 3 4 5 6 7 8 9
    1 2 3 4 5 6 7 8 9
    1 2 3 4 5 6 7