#include <format>
    #include <ranges>
     
    int main()
    {
        const auto nums = {1, 2, 3, 4, 5, 6, 7, 8, 9};
     
        for (int i : std::ranges::drop_view{nums, 2})
            [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 : nums | std::views::drop(2))
            [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](http://en.cppreference.com/w/cpp/ranges/iota_view)(1, 10) | std::views::drop(2))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        // Note that dropping more than the number of elements is OK:
        for (auto i : {8, 9, 10, 100}) {
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << [std::format](http://en.cppreference.com/w/cpp/utility/format/format)("drop {}: ", i);
            for (int i : std::[views::iota](http://en.cppreference.com/w/cpp/ranges/iota_view)(1, 10) | std::views::drop(i))
                [std::cout](http://en.cppreference.com/w/cpp/io/cout) << i << ' ';
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
        }
    }

Output:

    
    
    3 4 5 6 7 8 9 
    3 4 5 6 7 8 9 
    3 4 5 6 7 8 9 
    drop 8: 9 
    drop 9: 
    drop 10: 
    drop 100:

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_view&action=edit&section=5 "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 3407 ](https://cplusplus.github.io/LWG/issue3407) |  C++20  |  ` views::drop ` sometimes fails to   
construct a sized random access range  |  the construction is adjusted   
so that it is always valid  
[ LWG 3494 ](https://cplusplus.github.io/LWG/issue3494) |  C++20  |  ` drop_view ` was never a ` borrowed_range ` |  it is a ` borrowed_range ` if its underlying view is   
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/drop_view&action=edit&section=6 "Edit
section: See also") ]  See also

[ ranges::drop_while_view  views::drop_while  ](/w/cpp/ranges/drop_while_view "cpp/ranges/drop while view") (C++20)  |  a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") consisting of the elements of another [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") , skipping the initial subsequence of elements until the first element where the predicate returns  false    
(class template)  (range adaptor object)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/dsc_drop_while_view&action=edit)  
---|---  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/drop_view&oldid=170980
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/drop_view&oldid=170980)
"

#####  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_view "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/drop_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_view&printable=yes "Printable version of this page \[p\]")
  * [ Permanent link ](/mwiki/index.php?title=cpp/ranges/drop_view&oldid=170980 "Perman