:relfileprefix: ../../../
[#boost-urls-authority_view-2constructor-03]

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


Construct from a string.


=== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
explicit
authority_view(core::string_view s);
----

=== Description


This function attempts to construct
an authority from the string `s`,
which must be a valid &lsqb;'authority&rsqb; or
else an exception is thrown. Upon
successful construction, the view
refers to the characters in the
buffer pointed to by `s`.
Ownership is not transferred; The
caller is responsible for ensuring
that the lifetime of the buffer
extends until the view is destroyed.
[,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
----

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)]








=== See Also


xref:boost/urls/parse_authority.adoc[parse_authority]
.



