[#boost-urls-arg]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::arg
:relfileprefix: ../../
:mrdocs:

Designate a named argument for a replacement field

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class T&gt;
xref:boost/urls/named_arg.adoc[named&lowbar;arg&lt;T&gt;]
arg(
    core::string&lowbar;view name,
    T const& arg);
----

== Description

Construct a named argument for a format URL string that contains named replacement fields&period;

The function parameters should be convertible to an implementation defined type able to store the name and a reference to any type potentially used as a format argument&period;

== Example

[,cpp]
----
assert(format(
    "https://example.com/~{username}",
    arg("username", "mark")
    ).buffer() == "https://example.com/~mark");
----
== Return Value

A temporary object with reference semantics for a named argument

== Parameters

[cols="1,4"]
|===
|Name|Description

| *name*
| The format argument name
| *arg*
| The format argument value
|===

== See Also

xref:boost/urls/format-06.adoc[`format`], xref:boost/urls/format_to-01.adoc[`format&lowbar;to`]&period;


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