:relfileprefix: ../../../
[#boost-urls-param_pct_view-2constructor-05]

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


Constructor


=== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class OptionalString>
param_pct_view(
    xref:boost/urls/pct_string_view.adoc[pct_string_view] key,
    OptionalString const& value);
----

=== Description


This constructs a parameter with a key
and optional value, which may both
contain percent escapes.

The new key and value reference
the same corresponding underlying
character buffers.

Ownership of the buffers is not transferred;
the caller is responsible for ensuring that
the assigned buffers remain valid until
they are no longer referenced.
[,cpp]
----
param_pct_view qp( "key", optional<core::string_view>("value") );
----
[,cpp]
----
this->key.data() == key.data() && this->value->data() == value->data() && this->has_value == true
----

=== Linear in `key.size() + value-&gt;size()`.

=== Exceptions thrown on invalid input.



=== Exceptions

|===
| Name | Thrown on

| ``key``
| 
or `value` contains an invalid percent-encoding.

|===



=== Parameters

|===
| Name | Description 

| *key,*
| 
value The key and value to set.

|===




