[#boost-urls-url_view_base-host] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url_view_base]::host :relfileprefix: ../../../ :mrdocs: Return the host == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1059[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string]> StringToken::result_type host(StringToken&& token = {}); ---- == Description This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent‐escapes in the string are decoded first. == Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" ); ---- == Complexity Linear in `this‐>host().size()`. == Exception Safety Calls to allocate may throw. == BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[] == Return Value The host address as a string. == Parameters [cols=2] |=== | Name | Description | *token* | A string token customization |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#