[#boost-urls-params_ref-assign-098]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/params_ref.adoc[params&lowbar;ref]::assign
:relfileprefix: ../../../
:mrdocs:

Assign elements

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_ref.hpp#Lundefined[boost&sol;url&sol;params&lowbar;ref&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
assign(std::initializer&lowbar;list&lt;param&lowbar;view&gt; init);
----

== Description

This function replaces the entire contents of the view with the params in the _initializer&hyphen;list_&period;

All iterators are invalidated&period;

[NOTE]
====
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined&period;

====

== Example

[,cpp]
----
url u;

u.params().assign( {{ "first", "John" }, { "last", "Doe" }} );
----
== Complexity

Linear in `init&period;size()`&period;

== Exception Safety

Strong guarantee&period; Calls to allocate may throw&period;

== Parameters

[cols="1,4"]
|===
|Name|Description

| *init*
| The list of params to assign&period;
|===


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