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

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


A view representing path segments in a URL


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_ref.hpp#L88[boost/url/segments_encoded_ref.hpp,window=blank_]>`

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

===  Types
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/segments_encoded_base/const_iterator.adoc[`const_iterator`]  ¦

A Bidirectional iterator to a path segment

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

The reference type

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

A signed integer type used to represent differences.

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

A Bidirectional iterator to a path segment

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

The reference type

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

An unsigned integer type used to represent size.

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

The value type

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

Assign segments

¦xref:boost/urls/segments_encoded_base/back.adoc[`back`]  ¦

Return the last segment

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

Return an iterator to the beginning

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

Return the referenced character buffer.

¦xref:boost/urls/segments_encoded_ref/clear.adoc[`clear`]  ¦

Clear the contents of the container

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

Return true if there are no segments

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

Return an iterator to the end

¦xref:boost/urls/segments_encoded_ref/erase.adoc[`erase`]  ¦

Erase segments

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

Return the first segment

¦xref:boost/urls/segments_encoded_ref/insert.adoc[`insert`]  ¦

Insert segments

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

Returns true if this references an absolute path.

¦xref:boost/urls/segments_encoded_ref/2conversion.adoc[`operator segments_encoded_view`]  ¦

Conversion

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

Assignment

¦xref:boost/urls/segments_encoded_ref/pop_back.adoc[`pop_back`]  ¦

Remove the last segment

¦xref:boost/urls/segments_encoded_ref/push_back.adoc[`push_back`]  ¦

Append a segment

¦xref:boost/urls/segments_encoded_ref/replace.adoc[`replace`]  ¦

Replace segments

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

Constructor

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

Return the number of segments

¦xref:boost/urls/segments_encoded_ref/url.adoc[`url`]  ¦

Return the referenced url

|===
===  Static Member Functions
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/segments_encoded_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 segments,
where each segment is a string which may
contain percent-escapes.

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.

The view is modifiable; calling non-const
members causes changes to the referenced
url.
[,cpp]
----
url u( "/path/to/file.txt" );

segments_encoded_ref ps = u.encoded_segments();
----

The strings returned when iterators are
dereferenced have type
xref:boost/urls/pct_string_view.adoc[pct_string_view]
and may contain percent-escapes.

Reserved characters in inputs are
automatically escaped.
Escapes in inputs are preserved.

Exceptions are thrown on invalid inputs.

=== Changes to the underlying character buffer

can invalidate iterators which reference it.
Modifications made through the container
invalidate some or all iterators:



* xref:boost/urls/segments_encoded_ref/push_back.adoc[push_back]
: Only `end()`.

* xref:boost/urls/segments_encoded_ref/assign-0e.adoc[assign]
,
xref:boost/urls/segments_encoded_ref/clear.adoc[clear]
,
xref:boost/urls/segments_encoded_ref/operator_assign-02c.adoc[operator&equals;]
: All elements.

* xref:boost/urls/segments_encoded_ref/erase-006.adoc[erase]
: Erased elements and all
elements after (including `end()`).

* xref:boost/urls/segments_encoded_ref/insert-04.adoc[insert]
: All elements at or after
the insertion point (including `end()`).

* xref:boost/urls/segments_encoded_ref/replace-07.adoc[replace]
: Modified
elements and all elements
after (including `end()`).



=== See Also


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



