](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_front&action=edit)  
[ back  ](/w/cpp/ranges/view_interface/back "cpp/ranges/view interface/back") (C++20)  |  returns the last element in the derived view. Provided if it satisfies [ ` bidirectional_range ` ](/w/cpp/ranges/bidirectional_range "cpp/ranges/bidirectional range") and [ ` common_range ` ](/w/cpp/ranges/common_range "cpp/ranges/common range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_back&action=edit)  
[ operator[]  ](/w/cpp/ranges/view_interface/operator_at "cpp/ranges/view interface/operator at") (C++20)  |  returns the n  th  element in the derived view. Provided if it satisfies [ ` random_access_range ` ](/w/cpp/ranges/random_access_range "cpp/ranges/random access range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_operator_at&action=edit)  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_while_view&action=edit&section=2
"Edit section: Deduction guides") ]  [ Deduction guides
](/w/cpp/ranges/drop_while_view/deduction_guides "cpp/ranges/drop while
view/deduction guides")

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_while_view&action=edit&section=3
"Edit section: Helper templates") ]  Helper templates

template  < class  T,  class  Pred  >  
inline  constexpr  bool  enable_borrowed_range  < std  ::  ranges  ::
drop_while_view  < T, Pred  >> =  
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 `
drop_while_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/drop_while_view&action=edit&section=4
"Edit section: Notes") ]  Notes

In order to provide the amortized constant time complexity required by the [ `
range ` ](/w/cpp/ranges/range "cpp/ranges/range") concept, the result of [ `
begin ` ](/w/cpp/ranges/drop_while_view/begin "cpp/ranges/drop while
view/begin") is cached within the ` drop_while_view ` object. If the
underlying range is modified after the first call to  begin()  , subsequent
uses of the ` drop_while_view ` object might have unintuitive behavior.

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

Run this code

    
    
    #include <algorithm>
    #include <iomanip>
    #include <iostream>
    #include <ranges>
    #include <string>
    #include <string_view>
     
    using std::operator""sv;
     
    [[nodiscard]]
    constexpr bool is_space(char q) noexcept
    {
        static constexpr auto ws = {' ', '\t', '\n', '\v', '\r', '\f'};
        return std::[ranges::any_of](http://en.cppreference.com/w/cpp/ranges-algorithm-placeholder/all_any_none_of)(ws, [q](auto p) { return p == q; });
    };
     
    [[nodiscard]]
    constexpr [std::string](http://en.cppreference.com/w/cpp/string/basic_string) trim_left([std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) const in) noexcept
    {
        auto view = in | std::views::drop_while(is_space);
        return {view.begin(), view.end()};
    }
     
    [[nodiscard]]
    constexpr [std::string](http://en.cppreference.com/w/cpp/string/basic_string) trim([std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) const in)
    {
        auto view = in
                  | std::views::drop_while(is_space) | std::[views::reverse](http://en.cppreference.com/w/cpp/ranges/reverse_view)
                  | std::view