[func.wrap.ref.ctor]

# 22 General utilities library [[utilities]](./#utilities)

## 22.10 Function objects [[function.objects]](function.objects#func.wrap.ref.ctor)

### 22.10.17 Polymorphic function wrappers [[func.wrap]](func.wrap#ref.ctor)

#### 22.10.17.6 Non-owning wrapper [[func.wrap.ref]](func.wrap.ref#ctor)

#### 22.10.17.6.3 Constructors and assignment operators [func.wrap.ref.ctor]

[ð](#:function_ref::is-invocable-using)

`template<class... T>
  static constexpr bool is-invocable-using = see below;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15003)

If *noex* is true,*is-invocable-using*<T...> is equal to:is_nothrow_invocable_r_v<R, T..., ArgTypes...>

Otherwise, *is-invocable-using*<T...> is equal to:is_invocable_r_v<R, T..., ArgTypes...>

[ð](#lib:function_ref,constructor)

`template<class F> function_ref(F* f) noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15021)

*Constraints*: 

- [(2.1)](#2.1)

is_function_v<F> is true, and

- [(2.2)](#2.2)

*is-invocable-using*<F> is true[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15028)

*Preconditions*: f is not a null pointer[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15032)

*Effects*: Initializes*bound-entity* with f, and*thunk-ptr* with the address of a function *thunk* such that*thunk*(*bound-entity*, *call-args*...) is expression-equivalent ([[defns.expression.equivalent]](defns.expression.equivalent "3.22 expression-equivalent")) toinvoke_r<R>(f, *call-args*...)[.](#4.sentence-1)

[ð](#lib:function_ref,constructor_)

`template<class F> constexpr function_ref(F&& f) noexcept;
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15049)

Let T be remove_reference_t<F>[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15052)

*Constraints*: 

- [(6.1)](#6.1)

remove_cvref_t<F> is not the same type as function_ref,

- [(6.2)](#6.2)

is_member_pointer_v<T> is false, and

- [(6.3)](#6.3)

*is-invocable-using*<cv T&> is true[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15060)

*Effects*: Initializes*bound-entity* with addressof(f), and*thunk-ptr* with the address of a function *thunk* such that*thunk*(*bound-entity*, *call-args*...) is expression-equivalent ([[defns.expression.equivalent]](defns.expression.equivalent "3.22 expression-equivalent")) toinvoke_r<R>(static_cast<cv T&>(f), *call-args*...)[.](#7.sentence-1)

[ð](#lib:function_ref,constructor__)

`template<auto f> constexpr function_ref(nontype_t<f>) noexcept;
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15077)

Let F be decltype(f)[.](#8.sentence-1)

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15080)

*Constraints*: *is-invocable-using*<F> is true[.](#9.sentence-1)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15084)

*Mandates*: If is_pointer_v<F> || is_member_pointer_v<F> is true,
then f != nullptr is true[.](#10.sentence-1)

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15089)

*Effects*: Initializes*bound-entity* with a pointer to an unspecified object or
null pointer value, and*thunk-ptr* with the address of a function *thunk* such that*thunk*(*bound-entity*, *call-args*...) is expression-equivalent ([[defns.expression.equivalent]](defns.expression.equivalent "3.22 expression-equivalent")) toinvoke_r<R>(f, *call-args*...)[.](#11.sentence-1)

[ð](#lib:function_ref,constructor___)

`template<auto f, class U>
  constexpr function_ref(nontype_t<f>, U&& obj) noexcept;
`

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15108)

Let T be remove_reference_t<U> andF be decltype(f)[.](#12.sentence-1)

[13](#13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15112)

*Constraints*: 

- [(13.1)](#13.1)

is_rvalue_reference_v<U&&> is false, and

- [(13.2)](#13.2)

*is-invocable-using*<F, cv T&> is true[.](#13.sentence-1)

[14](#14)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15119)

*Mandates*: If is_pointer_v<F> || is_member_pointer_v<F> is true,
then f != nullptr is true[.](#14.sentence-1)

[15](#15)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15124)

*Effects*: Initializes*bound-entity* with addressof(obj), and*thunk-ptr* with the address of a function *thunk* such that*thunk*(*bound-entity*, *call-args*...) is expression-equivalent ([[defns.expression.equivalent]](defns.expression.equivalent "3.22 expression-equivalent")) toinvoke_r<R>(f, static_cast<cv T&>(obj), *call-args*...)[.](#15.sentence-1)

[ð](#lib:function_ref,constructor____)

`template<auto f, class T>
  constexpr function_ref(nontype_t<f>, cv T* obj) noexcept;
`

[16](#16)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15142)

Let F be decltype(f)[.](#16.sentence-1)

[17](#17)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15145)

*Constraints*: *is-invocable-using*<F, cv T*> is true[.](#17.sentence-1)

[18](#18)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15149)

*Mandates*: If is_pointer_v<F> || is_member_pointer_v<F> is true,
then f != nullptr is true[.](#18.sentence-1)

[19](#19)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15154)

*Preconditions*: If is_member_pointer_v<F> is true,obj is not a null pointer[.](#19.sentence-1)

[20](#20)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15159)

*Effects*: Initializes*bound-entity* with obj, and*thunk-ptr* with the address of a function *thunk* such that*thunk*(*bound-entity*, *call-args*...) is expression-equivalent ([[defns.expression.equivalent]](defns.expression.equivalent "3.22 expression-equivalent")) toinvoke_r<R>(f, obj, *call-args*...)[.](#20.sentence-1)

[ð](#lib:operator=,function_ref)

`template<class T> function_ref& operator=(T) = delete;
`

[21](#21)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15176)

*Constraints*: 

- [(21.1)](#21.1)

T is not the same type as function_ref,

- [(21.2)](#21.2)

is_pointer_v<T> is false, and

- [(21.3)](#21.3)

T is not a specialization of nontype_t[.](#21.sentence-1)
