[#boost-urls-authority_view-host_ipv6_address]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/authority_view.adoc[authority&lowbar;view]::host&lowbar;ipv6&lowbar;address
:relfileprefix: ../../../
:mrdocs:

Return the host IPv6 address

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:boost/urls/ipv6_address.adoc[ipv6&lowbar;address]
host&lowbar;ipv6&lowbar;address() const noexcept;
----

== Description

If the host type is xref:boost/urls/host_type.adoc[`host&lowbar;type&colon;&colon;ipv6`], this function returns the address as a value of type xref:boost/urls/ipv6_address.adoc[`ipv6&lowbar;address`]&period; Otherwise, if the host type is not an IPv6 address, it returns a default&hyphen;constructed value which is equal to the unspecified address &quot;0&colon;0&colon;0&colon;0&colon;0&colon;0&colon;0&colon;0&quot;&period;

== Example

[,cpp]
----
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
----
== Complexity

Constant&period;

== Exception Safety

Throws nothing&period;

== BNF

[,cpp]
----
IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal
----
== Specification

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

== Return Value

The host IPv6 address


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