[#boost-urls-ipv6_address-to_string] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/ipv6_address.adoc[ipv6_address]::to_string :relfileprefix: ../../../ :mrdocs: Return the address as a string. == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/ipv6_address.hpp#L222[boost/url/ipv6_address.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 to_string(StringToken&& token); ---- == Description The returned string does not contain surrounding square brackets. When called with no arguments, the return type is `std::string`. Otherwise, the return type and style of output is determined by which string token is passed. === Example [,cpp] ---- ipv6_address::bytes_type b = {{ 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8 }}; ipv6_address a(b); assert(a.to_string() == "1:2:3:4:5:6:7:8"); assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" ); ---- === Complexity Constant. === Exception Safety Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions. === Specification * link:https://datatracker.ietf.org/doc/html/rfc4291#section-2.2[ 2.2. Text Representation of Addresses (rfc4291)] == Return Value The return type of the string token. If the token parameter is omitted, then a new `std::string` is returned. Otherwise, the function return type is the result type of the token. == Parameters |=== | Name | Description | *token* | An optional string token. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#