[#bsl-function-0a-operator_assign-0f0f]
= xref:bsl.adoc[bsl]::xref:bsl/function-0a.adoc[function]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Copy&hyphen;assign the target from `rhs` and return `&ast;this`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;function&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/function-0a.adoc[bsl::function&lt;PROTOTYPE&gt;]&
operator&equals;(xref:bsl/function-0a.adoc[function] const& rhs);
----

== Description

Set the target of this object to a copy of the target (if any) held by the specified `rhs` object, destroy the target (if any) previously held by `&ast;this`, and return `&ast;this`&period; The result is equivalent to having constructed `&ast;this` from `rhs` using the extended copy constructor with allocator `this&hyphen;&gt;get&lowbar;allocator()`&period; If an exception is thrown, `&ast;this` is not modified (i&period;e&period;, copy assignment provides the strong exception guarantee)&period;

== Return Value

reference providing modifiable access to this object

== Parameters

[cols="1,4"]
|===
| Name| Description
| *rhs*
| function whose target is copied into this object
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
