> )  
return  const_cast  < const  R  & > (  r  )  ;  
else  
return  r  ;  
}  |  (1)  |  (  exposition only*  )   
---|---|---  
template  < class  T  >  
constexpr  auto  /* as-const-pointer */  (  const  T  *  p  )  noexcept  
{  
return  p  ;  
}  |  (2)  |  (  exposition only*  )   
|  |   
  
Some range access customization point objects are specified in terms of these
exposition-only function templates.

1)  /* possibly-const-range */  returns a const-qualified range  r  if it is a
deep-const range; otherwise, returns  r  without any casting.

2)  /* as-const-pointer */  returns a pointer to object of constant type.

####  [ [ edit ](/mwiki/index.php?title=cpp/ranges&action=edit&section=11
"Edit section: Range adaptor helpers") ]  Range adaptor helpers

template  < class  F,  class  Tuple  >  
constexpr  auto  /* tuple-transform */  (  F  && f, Tuple  && tuple  )  
{  
return  [ std::  apply  ](http://en.cppreference.com/w/cpp/utility/apply) (  [
& ]  < class  ...  Ts  > (  Ts  && ...  args  )  
{  
return  [ std::  tuple  ](http://en.cppreference.com/w/cpp/utility/tuple) < [
std::  invoke_result_t  ](http://en.cppreference.com/w/cpp/types/result_of) <
F  & , Ts  > ...  >  
(  [ std::  invoke
](http://en.cppreference.com/w/cpp/utility/functional/invoke) (  f, [ std::
forward  ](http://en.cppreference.com/w/cpp/utility/forward) < Ts  > (  args
)  )  ...  )  ;  
}  , [ std::  forward  ](http://en.cppreference.com/w/cpp/utility/forward) <
Tuple  > (  tuple  )  )  ;  
}  |  (1)  |  (  exposition only*  )   
---|---|---  
template  < class  F,  class  Tuple  >  
constexpr  void  /* tuple-for-each */  (  F  && f, Tuple  && tuple  )  
{  
[ std::  apply  ](http://en.cppreference.com/w/cpp/utility/apply) (  [  & ]  <
class  ...  Ts  > (  Ts  && ...  args  )  
{  
(  static_cast  < void  > (  [ std::  invoke
](http://en.cppreference.com/w/cpp/utility/functional/invoke) (  f, [ std::
forward  ](http://en.cppreference.com/w/cpp/utility/forward) < Ts  > (  args
)  )  )  , ...  )  ;  
}  , [ std::  forward  ](http://en.cppreference.com/w/cpp/utility/forward) <
Tuple  > (  tuple  )  )  ;  
}  |  (2)  |  (  exposition only*  )   
template  < class  T  >  
constexpr  T  & /* as-lvalue */  (  T  && t  )  
{  
return  static_cast  < T  & > (  t  )  ;  
}  |  (3)  |  (  exposition only*  )   
|  |   
  
Some range adaptors are specified in terms of these exposition-only function
templates.

1)  /* tuple-transform */  returns a new tuple constructed by applying  f  to
each element of  tuple  .

2)  /* tuple-for-each */  applies  f  to each element of  tuple  and returns
nothing.

3)  /* as-lvalue */  forwards rvalue  t  as lvalue.

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

Following exposition-only concepts are used for several types, but they are
not parts of the interface of standard library.

template  < class  R  >  
concept  /* simple-view */  =  
[ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view) < R  > && [
ranges::  range  ](http://en.cppreference.com/w/cpp/ranges/range) < const  R
> &&  
[ std::  same_as  ](http://en.cppreference.com/w/cpp/concepts/same_as) < [
ranges::  iterator_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-
placeholder/iterator_t) < R  > , [ ranges::  iterator_t
](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) <
const  R  >> &&  
[ std::  same_as  ](http://en.cppreference.com/w/cpp/concepts/same_as) < [ ranges::  sentinel_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) < R  > , [ ranges::  sentinel_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) < const  R  >> ;  |  (1)  |  (  exposition only*  )   
---|---|---  
template  < class  I  >  
concept  /* has-arrow */  =  
ranges  ::  input_iterator  < I  > &&  
(  [ std::  is_pointer_v  ](http://en.cppreference.com/w/cpp/types/is_pointer) < I  > ||  requires  (  I i  )  {  i.  oper