* S  \-  N  \+  1  , if ` S >= N ` , 
  * ​  0  ​  otherwise, and the resulting view is empty. 

2)  The name  views  ::  adjacent  < N  > denotes a [ RangeAdaptorObject
](/w/cpp/named_req/RangeAdaptorObject "cpp/named req/RangeAdaptorObject") .
Given a subexpression  e  and a constant expression  N  , the expression
views  ::  adjacent  < N  > (  e  )  is [ expression-equivalent
](/w/cpp/language/expressions#Expression-equivalence
"cpp/language/expressions") to

  * (  (  void  )  e,  auto  (  [ views::  empty  ](http://en.cppreference.com/w/cpp/ranges/empty_view) < tuple  <>> )  )  if  N  is equal to  ​  0  ​  , 
  * adjacent_view  < [ views::  all_t  ](http://en.cppreference.com/w/cpp/ranges/all_view) < decltype  (  (  e  )  )  > , N  > (  e  )  otherwise. 

3)  The name  views  ::  pairwise  denotes a [ RangeAdaptorObject
](/w/cpp/named_req/RangeAdaptorObject "cpp/named req/RangeAdaptorObject") that
behaves exactly as  views  ::  adjacent  < 2  > .

` adjacent_view ` always models [ ` forward_range `
](/w/cpp/ranges/forward_range "cpp/ranges/forward range") , and models [ `
bidirectional_range ` ](/w/cpp/ranges/bidirectional_range
"cpp/ranges/bidirectional range") , [ ` random_access_range `
](/w/cpp/ranges/random_access_range "cpp/ranges/random access range") , or [ `
sized_range ` ](/w/cpp/ranges/sized_range "cpp/ranges/sized range") if adapted
[ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") type models the
corresponding concept.

##  Contents

  * 1  Data members 
  * 2  Member functions 
    * 2.1  Inherited from  std::ranges::view_interface 
  * 3  Deduction guides 
  * 4  Nested classes 
  * 5  Helper templates 
  * 6  Notes 
  * 7  Example 
  * 8  References 
  * 9  See also 

  
---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/adjacent_view&action=edit&section=1 "Edit
section: Data members") ]  Data members

Member object  |  Definition   
---|---  
` _base__ ` (private)  |  the underlying [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") of type  V  .   
(  exposition-only member object*  )  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/adjacent_view&action=edit&section=2 "Edit
section: Member functions") ]  Member functions

[ (constructor)  ](/w/cpp/ranges/adjacent_view/adjacent_view "cpp/ranges/adjacent view/adjacent view") (C++23)  |  constructs a ` adjacent_view `   
(public member function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/adaptor/dsc_constructor&action=edit)  
---|---  
[ begin  ](/w/cpp/ranges/adjacent_view/begin "cpp/ranges/adjacent view/begin") (C++23)  |  returns an iterator to the beginning   
(public member function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/adaptor/dsc_begin&action=edit)  
[ end  ](/w/cpp/ranges/adjacent_view/end "cpp/ranges/adjacent view/end") (C++23)  |  returns an iterator or a sentinel to the end   
(public member function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/adaptor/dsc_end&action=edit)  
[ size  ](/w/cpp/ranges/adjacent_view/size "cpp/ranges/adjacent view/size") (C++23)  |  returns the number of elements. Provided only if the underlying (adapted) range satisfies [ ` sized_range ` ](/w/cpp/ranges/sized_range "cpp/ranges/sized range") .   
(public member function)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/adaptor/dsc_size&action=edit)  
  
#####  Inherited from  [ std::ranges::view_interface
](/w/cpp/ranges/view_interface "cpp/ranges/view interface")  
  
[ empty  ](/w/cpp/ranges/view_interface/empty "cpp/ranges/view interface/empty") (C++20)  |  returns whether the derived view is empty. Provided if it satisfies [ ` sized_range ` ](/w/cpp/ranges/sized_range "cpp/ranges/sized range") or [ ` forward_range ` ](/w/cpp/ranges/forward_range "cpp/ranges/forward range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.p