boost::urls::arg :: Boost Libraries Documentation

# boost::urls::arg

Designate a named argument for a replacement field

## Synopsis

Declared in `<boost/url/format.hpp>`

    template<class T>
    named_arg<T>
    arg(
        core::string_view name,
        T const& arg);

## Description

Construct a named argument for a format URL string that contains named replacement fields.

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.

## Example

    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

Name | Description
--- | ---
name | The format argument name
arg | The format argument value

## See Also

`format`, `format_to`.

Created with MrDocs