:relfileprefix: ../../../
[#DB35784268F127494FAA20500D80777B005712D9]

= Function ipv6_address::to_string

pass:v,q[Return the address as a string.]


== Synopsis

Declared in header `</boost/url/ipv6_address.hpp#L223[boost/url/ipv6_address.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class 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) const;
----

== Description

pass:v,q[The returned string does not] pass:v,q[contain surrounding square brackets.]
pass:v,q[When called with no arguments, the]
pass:v,q[return type is `std::string`.]
pass:v,q[Otherwise, the return type and style]
pass:v,q[of output is determined by which string]
pass:v,q[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
pass:v,q[Constant.]

=== Exception Safety
pass:v,q[Strong guarantee.]
pass:v,q[Calls to allocate may throw.]
pass:v,q[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

* `result_type` 


== Parameters

|===
| Name | Type 

| *token*
| ``

|===



