nt) < T  > )  (since C++23)  , if ` T ` is an array type with a known bound. 
  2. Otherwise,  [ ` _decay-copy_ ` ](/w/cpp/standard_library/decay-copy "cpp/standard library/decay-copy") (  t.  size  (  )  )  (until C++23)  auto  (  t.  size  (  )  )  (since C++23)  , if  [ ranges::  disable_sized_range  ](http://en.cppreference.com/w/cpp/ranges/sized_range) < [ std::  remove_cv_t  ](http://en.cppreference.com/w/cpp/types/remove_cv) < T  >> is  false  , and that expression is valid and has an [ integer-like ](/w/cpp/iterator/weakly_incrementable#Integer-like_types "cpp/iterator/weakly incrementable") type. 
  3. Otherwise,  [ ` _decay-copy_ ` ](/w/cpp/standard_library/decay-copy "cpp/standard library/decay-copy") (  size  (  t  )  )  (until C++23)  auto  (  size  (  t  )  )  (since C++23)  , if  [ ranges::  disable_sized_range  ](http://en.cppreference.com/w/cpp/ranges/sized_range) < [ std::  remove_cv_t  ](http://en.cppreference.com/w/cpp/types/remove_cv) < T  >> is  false  , and the converted expression is valid and has an [ integer-like ](/w/cpp/iterator/weakly_incrementable#Integer-like_types "cpp/iterator/weakly incrementable") type, where the meaning of ` size ` is established as if by performing [ argument-dependent lookup ](/w/cpp/language/adl "cpp/language/adl") only. 
  4. Otherwise,  /* to-unsigned-like */  (  [ ranges::  end  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/end) (  t  )  \-  [ ranges::  begin  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/begin) (  t  )  )  , if ` T ` models  [ ranges::  forward_range  ](http://en.cppreference.com/w/cpp/ranges/forward_range) and  [ ranges::  sentinel_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) < T  > models  [ std::  sized_sentinel_for  ](http://en.cppreference.com/w/cpp/iterator/sized_sentinel_for) < [ ranges::  iterator_t  ](http://en.cppreference.com/w/cpp/ranges-ranges-placeholder/iterator_t) < T  >> , 

     where  /* to-unsigned-like */  denotes an explicit conversion to an [ unsigned-integer-like ](/w/cpp/iterator/weakly_incrementable#Integer-like_types "cpp/iterator/weakly incrementable") type. 

In all other cases, a call to ` ranges::size ` is ill-formed, which can result
in [ substitution failure ](/w/cpp/language/sfinae "cpp/language/sfinae") when
ranges  ::  size  (  t  )  appears in the immediate context of a template
instantiation.

##  Contents

  * 1  Customization point objects 
  * 2  Notes 
  * 3  Example 
  * 4  Defect reports 
  * 5  See also 

  
---  
  
###  Customization point objects

The name ` ranges::size ` denotes a _customization point object_ , which is a
const [ function object ](/w/cpp/named_req/FunctionObject "cpp/named
req/FunctionObject") of a [ literal ](/w/cpp/named_req/LiteralType "cpp/named
req/LiteralType") [ ` semiregular ` ](/w/cpp/concepts/semiregular
"cpp/concepts/semiregular") class type. For exposition purposes, the cv-
unqualified version of its type is denoted as ` ___size_fn_ ` .

All instances of ` ___size_fn_ ` are equal. The effects of invoking different
instances of type ` ___size_fn_ ` on the same arguments are equivalent,
regardless of whether the expression denoting the instance is an lvalue or
rvalue, and is const-qualified or not (however, a volatile-qualified instance
is not required to be invocable). Thus, ` ranges::size ` can be copied freely
and its copies can be used interchangeably.

Given a set of types ` Args... ` , if  [ std::  declval
](http://en.cppreference.com/w/cpp/utility/declval) < Args  > (  )  ...  meet
the requirements for arguments to ` ranges::size ` above, ` ___size_fn_ `
models  

  * [ std::  invocable  ](http://en.cppreference.com/w/cpp/concepts/invocable) < __size_fn, Args...  > , 
  * [ std::  invocable  ](http://en.cppreference.com/w/cpp/concepts/invocable) < const  __size_fn, Args...  > , 
  * [ std::  invocable  ](http://en.cppreference.com/w/cpp/concepts/invocable) < __size_fn  & , Args...  > , and 
  * [ std::  invoc