:relfileprefix: ../../../
[#boost-urls-param-2constructor-0b]

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


Constructor


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class OptionalString>
param(
    core::string_view key,
    OptionalString const& value);
----

== Description


This constructs a parameter with a key
and value.

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

=== 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.size() + value.size()`.

=== Exception Safety

Calls to allocate may throw.





== Parameters

|===
| Name | Description 

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

|===




