:relfileprefix: ../../
[#64D24E2D9E11842076036A2888DA3B2B16491EB0]

= Class segments_view

pass:v,q[A view representing path segments in a URL]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
class segments_view
    : public xref:boost/urls/segments_base.adoc[segments_base];
----

==  Types
[,cols=2]
|===
|Name |Description
|xref:boost/urls/segments_base/const_iterator.adoc[`pass:v[const_iterator]`] |
xref:boost/urls/segments_base/iterator.adoc[iterator]

|xref:boost/urls/segments_base/const_reference.adoc[`pass:v[const_reference]`] |
pass:v,q[The reference type]

|xref:boost/urls/segments_base/difference_type.adoc[`pass:v[difference_type]`] |
pass:v,q[A signed integer type used to represent differences.]

|xref:boost/urls/segments_base/iterator.adoc[`pass:v[iterator]`] |

|xref:boost/urls/segments_base/reference.adoc[`pass:v[reference]`] |
pass:v,q[The reference type]

|xref:boost/urls/segments_base/size_type.adoc[`pass:v[size_type]`] |
pass:v,q[An unsigned integer type used to represent size.]

|xref:boost/urls/segments_base/value_type.adoc[`pass:v[value_type]`] |
pass:v,q[The value type]

|===
==  Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost/urls/segments_base/back.adoc[`pass:v[back]`] |
pass:v,q[Return the last segment]

|xref:boost/urls/segments_base/begin.adoc[`pass:v[begin]`] |
pass:v,q[Return an iterator to the beginning]

|xref:boost/urls/segments_base/buffer.adoc[`pass:v[buffer]`] |
pass:v,q[Return the referenced character buffer.]

|xref:boost/urls/segments_base/empty.adoc[`pass:v[empty]`] |
pass:v,q[Return true if there are no segments]

|xref:boost/urls/segments_base/end.adoc[`pass:v[end]`] |
pass:v,q[Return an iterator to the end]

|xref:boost/urls/segments_base/front.adoc[`pass:v[front]`] |
pass:v,q[Return the first segment]

|xref:boost/urls/segments_base/is_absolute.adoc[`pass:v[is_absolute]`] |
pass:v,q[Returns true if this references an absolute path.]

|xref:boost/urls/segments_view/operator_assign.adoc[`pass:v[operator=]`] |
pass:v,q[Assignment]

|xref:boost/urls/segments_view/2constructor.adoc[`pass:v[segments_view]`] |
pass:v,q[Constructor]

|xref:boost/urls/segments_base/size.adoc[`pass:v[size]`] |
pass:v,q[Return the number of segments]

|===
==  Static Member Functions
[,cols=2]
|===
|Name |Description
|xref:boost/urls/segments_base/max_size.adoc[`pass:v[max_size]`] |
pass:v,q[Return the maximum number of characters possible]

|===

== Description

pass:v,q[Objects of this type are used to interpret] pass:v,q[the path as a bidirectional view of segment]
pass:v,q[strings.]
pass:v,q[The view does not retain ownership of the]
pass:v,q[elements and instead references the original]
pass:v,q[character buffer. The caller is responsible]
pass:v,q[for ensuring that the lifetime of the buffer]
pass:v,q[extends until it is no longer referenced.]

=== Example
[,cpp]
----
url_view u( "/path/to/file.txt" );

segments_view ps = u.segments();

assert( ps.buffer().data() == u.buffer().data() );
----
pass:v,q[Percent escapes in strings returned when]
pass:v,q[dereferencing iterators are automatically]
pass:v,q[decoded.]

=== Iterator Invalidation
pass:v,q[Changes to the underlying character buffer]
pass:v,q[can invalidate iterators which reference it.]



