:relfileprefix: ../../../
[#boost-urls-params_encoded_view-2constructor-0c]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/params_encoded_view.adoc[pass:[params_encoded_view]]::params_encoded_view


Constructor


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_view.hpp#L169[boost/url/params_encoded_view.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
params_encoded_view(core::string_view s);
----

=== Description


This function constructs params from
a valid query parameter string, which
can contain percent escapes. Unlike
the parameters in URLs, the string
passed here should not start with "?".
Upon construction, the view
references the character buffer pointed
to by `s`. The caller is responsible
for ensuring that the lifetime of the
buffer extends until it is no longer
referenced.
[,cpp]
----
params_encoded_view qp( "first=John&last=Doe" );
----
[,cpp]
----
return parse_query( s ).value();
----
[,cpp]
----
this->buffer().data() == s.data()
----

=== Linear in `s`.

=== Exceptions thrown on invalid input.
[,cpp]
----
query-params    = [ query-param ] *( "&" query-param )

query-param     = key [ "=" value ]
----

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3.4.  Query]



=== Exceptions

|===
| Name | Thrown on

| ``s``
| 
contains an invalid query parameter
string.

|===



=== Parameters

|===
| Name | Description 

| *s*
| 
The string to parse.

|===




