[#boost-urls-authority_view-2constructor-03]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/authority_view.adoc[authority&lowbar;view]::authority&lowbar;view
:relfileprefix: ../../../
:mrdocs:

Construct from a string&period;

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L157[boost&sol;url&sol;authority&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
authority&lowbar;view(core::string&lowbar;view s);
----

== Description

This function attempts to construct an authority from the string `s`, which must be a valid authority or else an exception is thrown&period; Upon successful construction, the view refers to the characters in the buffer pointed to by `s`&period; Ownership is not transferred&semi; the caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed&period;

== BNF

[,cpp]
----
authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT
----
== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3&period;2&period; Authority (rfc3986)]

== Parameters

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

| *s*
| The string to parse
|===

== See Also

xref:boost/urls/parse_authority.adoc[`parse&lowbar;authority`]&period;


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