< T  >> =  
std  ::  [ ranges::  enable_borrowed_range  ](http://en.cppreference.com/w/cpp/ranges/borrowed_range) < T  > ;  |  |  (since C++20)   
---|---|---  
|  |   
  
This specialization of [ ` std::ranges::enable_borrowed_range `
](/w/cpp/ranges/borrowed_range "cpp/ranges/borrowed range") makes `
reverse_view ` satisfy [ ` borrowed_range ` ](/w/cpp/ranges/borrowed_range
"cpp/ranges/borrowed range") when the underlying view satisfies it.

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

Run this code

    
    
    #include <iostream>
    #include <ranges>
     
    int main()
    {
        static constexpr auto il = {3, 1, 4, 1, 5, 9};
     
        std::ranges::reverse_view rv{il};
        for (int i : rv)
            [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 : il | std::views::reverse)
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        // operator[] is inherited from std::view_interface
        for (auto i{0U}; i != rv.size(); ++i)
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << rv[i] << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
    }

Output:

    
    
    9 5 1 4 1 3
    9 5 1 4 1 3
    9 5 1 4 1 3

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

The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.

DR  |  Applied to  |  Behavior as published  |  Correct behavior   
---|---|---|---  
[ LWG 3494 ](https://cplusplus.github.io/LWG/issue3494) |  C++20  |  ` reverse_view ` was never a ` borrowed_range ` |  it is a ` borrowed_range ` if its underlying view is   
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/reverse_view&action=edit&section=8 "Edit
section: See also") ]  See also

[ reverse_iterator  ](/w/cpp/iterator/reverse_iterator "cpp/iterator/reverse iterator") |  iterator adaptor for reverse-order traversal   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/iterator/dsc_reverse_iterator&action=edit)  
---|---  
[ ranges::reverse  ](/w/cpp/algorithm/ranges/reverse "cpp/algorithm/ranges/reverse") (C++20)  |  reverses the order of elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_reverse&action=edit)  
[ ranges::reverse_copy  ](/w/cpp/algorithm/ranges/reverse_copy "cpp/algorithm/ranges/reverse copy") (C++20)  |  creates a copy of a range that is reversed   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_reverse_copy&action=edit)  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/reverse_view&oldid=160905
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/reverse_view&oldid=160905)
"

#####  Navigation

  * [ Support us ](http://www.cppreference.com/support)
  * [ Recent changes ](/w/Special:RecentChanges "A list of recent changes in the wiki \[r\]")
  * [ FAQ ](/w/Cppreference:FAQ)
  * [ Offline version ](/w/Cppreference:Archives)

#####  Toolbox

  * [ What links here ](/w/Special:WhatLinksHere/cpp/ranges/reverse_view "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/reverse_view "Recent changes in pages linked from this page \[k\]")
  * [ Upload file ](http://upload.cppreference.com/w/Special:Upload "Upload files \[u\]")
  * [ Special pages ](/w/Special:SpecialPages "A list of all special pages \[q\]")
  * [ Printable version ](/mwiki/index.php?title=cpp/ranges/reverse_view&printable=yes "Printable version of this page