[#boost-urls-param-2constructor-0b]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/param.adoc[param]::param
:relfileprefix: ../../../
:mrdocs:

Constructor

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/param.hpp#L283[boost&sol;url&sol;param&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class OptionalString&gt;
param(
    core::string&lowbar;view key,
    OptionalString const& value);
----

== Description

This constructs a parameter with a key and value&period;

No validation is performed on the strings&period; Ownership of the key and value is acquired by making copies&period;

== Example

[,cpp]
----
param qp( "key", "value" );
----
[,cpp]
----
param qp( "key", optional<core::string_view>("value") );
----
[,cpp]
----
param qp( "key", boost::none );
----
[,cpp]
----
param qp( "key", nullptr );
----
[,cpp]
----
param qp( "key", no_value );
----
== Postconditions

[,cpp]
----
this->key == key && this->value == value && this->has_value == true
----
== Complexity

Linear in `key&period;size() &plus; value&period;size()`&period;

== Exception Safety

Calls to allocate may throw&period;

== Template Parameters

[cols="1,4"]
|===
| Name| Description
| *OptionalString*
| An optional string type, such as `core&colon;&colon;string&lowbar;view`, `std&colon;&colon;nullptr`, xref:boost/urls/no_value_t.adoc[`no&lowbar;value&lowbar;t`], or `optional&lt;core&colon;&colon;string&lowbar;view&gt;`&period;
|===

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| The key to set&period;
| *value*
| The value to set&period;
|===


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