s::drop_while(is_space) | std::[views::reverse](http://en.cppreference.com/w/cpp/ranges/reverse_view)
                  ;
        return {view.begin(), view.end()};
    }
     
    int main()
    {
        static_assert(trim_left(" \n C++23") == "C++23"sv);
        constexpr [std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) src = " \f\n\t\r\vHello, C++20!\f\n\t\r\v ";
     
        const auto s = trim(src);
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "s = " << [std::quoted](http://en.cppreference.com/w/cpp/io/manip/quoted)(s) << '\n';
     
        static constexpr auto v = {0, 1, 2, 3, 4, 5};
        for (int n : v | std::views::drop_while([](int i) { return i < 3; }))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << n << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
    }

Output:

    
    
    s = "Hello, C++20!"
    3 4 5

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_while_view&action=edit&section=6
"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  |  ` drop_while_view ` was never a ` borrowed_range ` |  it is a ` borrowed_range ` if its underlying view is   
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_while_view&action=edit&section=7
"Edit section: See also") ]  See also

[ ranges::drop_view  views::drop  ](/w/cpp/ranges/drop_view "cpp/ranges/drop view") (C++20)  |  a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") consisting of elements of another [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") , skipping the first N elements   
(class template)  (range adaptor object)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/dsc_drop_view&action=edit)  
---|---  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/drop_while_view&oldid=156054
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/drop_while_view&oldid=156054)
"

#####  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/drop_while_view "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/drop_while_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/drop_while_view&printable=yes "Printable version of this page \[p\]")
  * [ Permanent link ](/mwiki/index.php?title=cpp/ranges/drop_while_view&oldid=156054 "Permanent link to this revision of the page")
  * [ Page information ](/mwiki/index.php?title=cpp/ranges/drop_while_view&action=info)

  * In other languages 

  * [ Español ](http://es.cppreference.com/w/cpp/ranges/drop_while_view "cpp/ranges/drop while view")
  * [ 日本語 ](http://ja.cppreference.com/w/cpp/ranges/drop_while_view "cpp/ranges/drop while view")
  * [ Русский ](http://ru.cppreference.com/w/cpp/ranges/drop_while_view "cpp/ranges/drop while view")
  * [ 中文 ](http://zh.cppreference.com/w/cpp/ranges/drop_while_view "cpp/ranges/drop while view")

  * This page was last modified on 1 August 2023, at 15:22. 
  * This page has been accessed 18,828 times. 

  * [ Privacy policy ](/w/Cppreference:Privacy_policy "Cppreference:Privacy policy")
  * [ About cppreference.com ](/w/Cppreference:About "Cppreference:About")
  * [ Disclaimers ](/w/C