[#boost-urls-param-2constructor-0ba]
= 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#L277[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


|===
| 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


|===
| Name | Description

| *key,*
| value The key and value to set&period;


|===



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