:relfileprefix: ../../
[#CDDAF7814EFEDBF1B4E68A3AB5AFC87C79644C5D]

= Class segments_ref

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


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
class segments_ref
    : 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_ref/assign.adoc[`pass:v[assign]`] |
pass:v,q[Assign segments]

|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_ref/clear.adoc[`pass:v[clear]`] |
pass:v,q[Clear the contents of the container]

|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_ref/erase.adoc[`pass:v[erase]`] |
pass:v,q[Erase segments]

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

|xref:boost/urls/segments_ref/insert.adoc[`pass:v[insert]`] |
pass:v,q[Insert segments]

|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_ref/2conversion.adoc[`pass:v[operator segments_view]`] |
pass:v,q[Conversion]

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

|xref:boost/urls/segments_ref/pop_back.adoc[`pass:v[pop_back]`] |
pass:v,q[Remove the last segment]

|xref:boost/urls/segments_ref/push_back.adoc[`pass:v[push_back]`] |
pass:v,q[Append a segment]

|xref:boost/urls/segments_ref/replace.adoc[`pass:v[replace]`] |
pass:v,q[Replace segments]

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

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

|xref:boost/urls/segments_ref/url.adoc[`pass:v[url]`] |
pass:v,q[Return the referenced url]

|===
==  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 segments,]
pass:v,q[where each segment is a string with percent]
pass:v,q[escapes automatically decoded.]
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.]
pass:v,q[The view is modifiable; calling non-const]
pass:v,q[members causes changes to the referenced]
pass:v,q[url.]

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

segments_ref ps = u.segments();
----
pass:v,q[Percent escapes in strings returned when]
pass:v,q[dereferencing iterators are automatically]
pass:v,q[decoded.]
pass:v,q[Reserved characters in strings supplied]
pass:v,q[to modifier functions are automatically]
pass:v,q[percent-escaped.]

=== Iterator Invalidation
pass:v,q[Changes to the underlying character buffer]
pass:v,q[can invalidate iterators which reference it.]
pass:v,q[Modifications made through the container]
pass:v,q[invalidate some or all iterators:]

* xref:boost/urls/segments_ref/push_back.adoc[push_back]
pass:v,q[: Only `end()`.]

* xref:boost/urls/segments_ref/assign-08.adoc[assign,]
xref:boost/urls/segments_ref/clear.adoc[clear,]
xref:boost/urls/segments_ref/operator_assign-0d.adoc[operator=]
pass:v,q[: All elements.]

* xref:boost/urls/segments_ref/erase-0af2.adoc[erase]
pass:v,q[: Erased elements and all]
pass:v,q[elements after (including `end()`).]

* xref:boost/urls/segments_ref/insert-05.adoc[insert]
pass:v,q[: All elements at or after]
pass:v,q[the insertion point (including `end()`).]

* xref:boost/urls/segments_ref/replace-05.adoc[replace]
pass:v,q[: Modified]
pass:v,q[elements and all elements]
pass:v,q[after (including `end()`).]



