:relfileprefix: ../../
[#boost-urls-segments_view]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::segments_view


A view representing path segments in a URL


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/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,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/segments_base/const_iterator.adoc[`const_iterator`]  ¦

A Bidirectional iterator to a path segment

¦xref:boost/urls/segments_base/const_reference.adoc[`const_reference`]  ¦

The reference type

¦xref:boost/urls/segments_base/difference_type.adoc[`difference_type`]  ¦

A signed integer type used to represent differences.

¦xref:boost/urls/segments_base/iterator.adoc[`iterator`]  ¦

A Bidirectional iterator to a path segment

¦xref:boost/urls/segments_base/reference.adoc[`reference`]  ¦

The reference type

¦xref:boost/urls/segments_base/size_type.adoc[`size_type`]  ¦

An unsigned integer type used to represent size.

¦xref:boost/urls/segments_base/value_type.adoc[`value_type`]  ¦

The value type

|===
===  Member Functions
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/segments_base/back.adoc[`back`]  ¦

Return the last segment

¦xref:boost/urls/segments_base/begin.adoc[`begin`]  ¦

Return an iterator to the beginning

¦xref:boost/urls/segments_base/buffer.adoc[`buffer`]  ¦

Return the referenced character buffer.

¦xref:boost/urls/segments_base/empty.adoc[`empty`]  ¦

Return true if there are no segments

¦xref:boost/urls/segments_base/end.adoc[`end`]  ¦

Return an iterator to the end

¦xref:boost/urls/segments_base/front.adoc[`front`]  ¦

Return the first segment

¦xref:boost/urls/segments_base/is_absolute.adoc[`is_absolute`]  ¦

Returns true if this references an absolute path.

¦xref:boost/urls/segments_view/operator_assign.adoc[`operator=`]  ¦

Assignment

¦xref:boost/urls/segments_view/2constructor.adoc[`segments_view`] [.small]#[constructor]# ¦

Constructor

¦xref:boost/urls/segments_base/size.adoc[`size`]  ¦

Return the number of segments

|===
===  Static Member Functions
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/segments_base/max_size.adoc[`max_size`]  ¦

Return the maximum number of characters possible

|===

=== Description


Objects of this type are used to interpret
the path as a bidirectional view of segment
strings.

The view does not retain ownership of the
elements and instead references the original
character buffer. The caller is responsible
for ensuring that the lifetime of the buffer
extends until it is no longer referenced.
[,cpp]
----
url_view u( "/path/to/file.txt" );

segments_view ps = u.segments();

assert( ps.buffer().data() == u.buffer().data() );
----

Percent escapes in strings returned when
dereferencing iterators are automatically
decoded.

=== Changes to the underlying character buffer

can invalidate iterators which reference it.



=== See Also


xref:boost/urls/segments_encoded_view.adoc[segments_encoded_view]
,
xref:boost/urls/segments_encoded_ref.adoc[segments_encoded_ref]
,
xref:boost/urls/segments_ref.adoc[segments_ref]
.



