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


Assign params

== Synopsis


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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
xref:boost/urls/params_encoded_ref/assign-00.adoc[assign](std::initializer&lowbar;list&lt;xref:boost/urls/param_pct_view.adoc[param&lowbar;pct&lowbar;view]&gt; init);
----

[.small]#xref:boost/urls/params_encoded_ref/assign-00.adoc[_» more..._]#

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FwdIt&gt;
void
xref:boost/urls/params_encoded_ref/assign-07.adoc[assign](
    FwdIt first,
    FwdIt last);
----

[.small]#xref:boost/urls/params_encoded_ref/assign-07.adoc[_» more..._]#

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FwdIt&gt;
void
xref:boost/urls/params_encoded_ref/assign-07.adoc[assign](
    FwdIt first,
    FwdIt last,
    std::forward&lowbar;iterator&lowbar;tag);
----

[.small]#xref:boost/urls/params_encoded_ref/assign-07.adoc[_» more..._]#

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class FwdIt&gt;
void
xref:boost/urls/params_encoded_ref/assign-07.adoc[assign](
    FwdIt first,
    FwdIt last,
    std::input&lowbar;iterator&lowbar;tag) = delete;
----

[.small]#xref:boost/urls/params_encoded_ref/assign-07.adoc[_» more..._]#

== 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.encoded_params().assign({ { "first", "John" }, { "last", "Doe" } });
----

=== Complexity

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


=== Exception Safety

Strong guarantee&period;        Calls to allocate may throw&period;        Exceptions thrown on invalid input&period;



== Exceptions


|===
| Name | Thrown on

| `system&lowbar;error`
| `init` contains an invalid percent&hyphen;encoding&period;


|===

== Parameters


|===
| Name | Description

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


| *first,*
| last The range of params        to assign&period;


|===



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