view:: _sentinel_ ::base  ](/w/cpp/ranges/take_view/sentinel/base
"cpp/ranges/take view/sentinel/base")  
[ operator==  (std::counted_iterator,take_view:: _sentinel_ )
](/w/cpp/ranges/take_view/sentinel/operator_cmp "cpp/ranges/take
view/sentinel/operator cmp")  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/take_view/navbar_content&action=edit)

Defined in header ` [ <ranges> ](/w/cpp/header/ranges "cpp/header/ranges") ` |  |   
---|---|---  
template  < [ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view)
V  >  
class  take_view  
:  public  [ ranges::  view_interface  ](http://en.cppreference.com/w/cpp/ranges/view_interface) < take_view  < V  >> |  (1)  |  (since C++20)   
namespace  views  {  
inline  constexpr  /* unspecified */  take  =  /* unspecified */  ;  
}  |  (2)  |  (since C++20)   
Call signature  |  |   
template  < [ ranges::  viewable_range
](http://en.cppreference.com/w/cpp/ranges/viewable_range) R  >  
requires  /* see below */  
constexpr  [ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view)
auto  
take  (  R  && r, [ ranges::  range_difference_t  ](http://en.cppreference.com/w/cpp/ranges/iterator_t) < R  > count  )  ;  |  |  (since C++20)   
template  < class  DifferenceType  >  
constexpr  /* range adaptor closure */  take  (  DifferenceType  && count  )  ;  |  |  (since C++20)   
|  |   
  
1)  A range adaptor that represents [ ` view ` ](/w/cpp/ranges/view
"cpp/ranges/view") of the elements from an underlying sequence, starting at
the beginning and ending at a given bound.

2)  ` views::take ` is a [ RangeAdaptorObject
](/w/cpp/named_req/RangeAdaptorObject "cpp/named req/RangeAdaptorObject") .
The expression  views  ::  take  (  e, f  )  results in a view that represents
the first  f  elements from  e  . The result is not necessarily a ` take_view
` .

views  ::  take  (  e, f  )  is [ expression-equivalent
](/w/cpp/language/expressions#Expression-equivalence
"cpp/language/expressions") to (where ` T ` is  [ std::  remove_cvref_t
](http://en.cppreference.com/w/cpp/types/remove_cvref) < decltype  (  (  e  )
)  > and ` D ` is  [ ranges::  range_difference_t
](http://en.cppreference.com/w/cpp/ranges/iterator_t) < decltype  (  (  e  )
)  > ):

  * (  (  void  )  f,  ` ` [ ` _decay-copy_ ` ](/w/cpp/standard_library/decay-copy "cpp/standard library/decay-copy") (  e  )  )  , if ` T ` is a  [ ranges::  empty_view  ](http://en.cppreference.com/w/cpp/ranges/empty_view) , except that the evaluations of  e  and  f  are indeterminately sequenced; 
  * U  (  [ ranges::  begin  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/begin) (  e  )  , [ ranges::  begin  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/begin) (  e  )  \+  [ std::  min  ](http://en.cppreference.com/w/cpp/algorithm/min) < D  > (  [ ranges::  distance  ](http://en.cppreference.com/w/cpp/iterator/ranges/distance) (  e  )  , f  )  )  , if ` T ` is a specialization of  [ std::  span  ](http://en.cppreference.com/w/cpp/container/span) ,  [ std::basic_string_view ](/w/cpp/string/basic_string_view "cpp/string/basic string view") , or  [ ranges::  subrange  ](http://en.cppreference.com/w/cpp/ranges/subrange) that models both [ ` random_access_range ` ](/w/cpp/ranges/random_access_range "cpp/ranges/random access range") and [ ` sized_range ` ](/w/cpp/ranges/sized_range "cpp/ranges/sized range") , where ` U ` is 

    

  * [ std::  span  ](http://en.cppreference.com/w/cpp/container/span) < typename  T  ::  element_type  > , if ` T ` is a specialization of  [ std::  span  ](http://en.cppreference.com/w/cpp/container/span) ; 
  * ` T ` , if ` T ` is a specialization of  [ std::basic_string_view ](/w/cpp/string/basic_string_view "cpp/string/basic string view") ; 
  * [ ranges::  subrange  ](http://en.cppreference.com/w/cpp/ranges/subrange) < [ ranges::  iterator_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) < T  >> , if ` T ` is a speciali