[func.bind.partial]

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

## 22.10 Function objects [[function.objects]](function.objects#func.bind.partial)

### 22.10.14 Function templates bind_front and bind_back [func.bind.partial]

[ð](#lib:bind_front)

`template<class F, class... Args>
  constexpr unspecified bind_front(F&& f, Args&&... args);
template<class F, class... Args>
  constexpr unspecified bind_back(F&& f, Args&&... args);
`

[1](#1)

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

Within this subclause:

- [(1.1)](#1.1)

g is a value of
the result of a bind_front or bind_back invocation,

- [(1.2)](#1.2)

FD is the type decay_t<F>,

- [(1.3)](#1.3)

fd is the target object of g ([[func.def]](func.def "22.10.3 Definitions"))
 of type FD,
 direct-non-list-initialized with std​::​forward<F​>(f),

- [(1.4)](#1.4)

BoundArgs is a pack
 that denotes decay_t<Args>...,

- [(1.5)](#1.5)

bound_args is
 a pack of bound argument entities of g ([[func.def]](func.def "22.10.3 Definitions"))
 of types BoundArgs...,
 direct-non-list-initialized with std​::​forward<Args>(args)...,
 respectively, and

- [(1.6)](#1.6)

call_args is an argument pack used in
 a function call expression ([[expr.call]](expr.call "7.6.1.3 Function call")) of g[.](#1.sentence-1)

[2](#2)

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

*Mandates*: is_constructible_v<FD, F> && is_move_constructible_v<FD> &&(is_constructible_v<BoundArgs, Args> && ...) &&(is_move_constructible_v<BoundArgs> && ...) is true[.](#2.sentence-1)

[3](#3)

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

*Preconditions*: FD meets the [*Cpp17MoveConstructible*](utility.arg.requirements#:Cpp17MoveConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements[.](#3.sentence-1)

For each Ti in BoundArgs,
if Ti is an object type,Ti meets the [*Cpp17MoveConstructible*](utility.arg.requirements#:Cpp17MoveConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements[.](#3.sentence-2)

[4](#4)

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

*Returns*: A perfect forwarding call wrapper ([[func.require]](func.require#term.perfect.forwarding.call.wrapper "22.10.4 Requirements")) g with call pattern:

- [(4.1)](#4.1)

invoke(fd, bound_args..., call_args...) for a bind_front invocation, or

- [(4.2)](#4.2)

invoke(fd, call_args..., bound_args...) for a bind_back invocation[.](#4.sentence-1)

[5](#5)

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

*Throws*: Any exception thrown by
the initialization of the state entities of g ([[func.def]](func.def "22.10.3 Definitions"))[.](#5.sentence-1)

[ð](#lib:bind_front_)

`template<auto f, class... Args>
  constexpr unspecified bind_front(Args&&... args);
template<auto f, class... Args>
  constexpr unspecified bind_back(Args&&... args);
`

[6](#6)

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

Within this subclause:

- [(6.1)](#6.1)

F is the type of f,

- [(6.2)](#6.2)

g is a value of the result of
a bind_front or bind_back invocation,

- [(6.3)](#6.3)

BoundArgs is a pack that denotes decay_t<Args>...,

- [(6.4)](#6.4)

bound_args is a pack of bound argument entities ofg ([[func.def]](func.def "22.10.3 Definitions")) of types BoundArgs...,
direct-non-list-initialized with std​::​forward<Args>(args)...,
respectively, and

- [(6.5)](#6.5)

call_args is an argument pack used in
a function call expression ([[expr.call]](expr.call "7.6.1.3 Function call")) of g[.](#6.sentence-1)

[7](#7)

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

*Mandates*: 

- [(7.1)](#7.1)

(is_constructible_v<BoundArgs, Args> && ...) is true, and

- [(7.2)](#7.2)

(is_move_constructible_v<BoundArgs> && ...) is true, and

- [(7.3)](#7.3)

if is_pointer_v<F> || is_member_pointer_v<F> is true,
then f != nullptr is true[.](#7.sentence-1)

[8](#8)

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

*Preconditions*: For each Ti in BoundArgs,Ti meets the [*Cpp17MoveConstructible*](utility.arg.requirements#:Cpp17MoveConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements[.](#8.sentence-1)

[9](#9)

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

*Returns*: A perfect forwarding call wrapper ([[func.require]](func.require "22.10.4 Requirements")) g that
does not have a target object, and has the call pattern:

- [(9.1)](#9.1)

invoke(f, bound_args..., call_args...) for a bind_front invocation, or

- [(9.2)](#9.2)

invoke(f, call_args..., bound_args...) for a bind_back invocation[.](#9.sentence-1)

[10](#10)

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

*Throws*: Any exception thrown by the initialization of bound_args[.](#10.sentence-1)
