:relfileprefix: ../../../
[#B71A326C9BA89C9A4074655682202C888E39FA89]

= Function url_view_base::segments

pass:v,q[Return the path as a container of segments]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls/segments_view.adoc[segments_view]
segments() const noexcept;
----

== Description

pass:v,q[This function returns a bidirectional] pass:v,q[view of strings over the path.]
pass:v,q[The returned view references the same]
pass:v,q[underlying character buffer; ownership]
pass:v,q[is not transferred.]
pass:v,q[Any percent-escapes in strings returned]
pass:v,q[when iterating the view are decoded first.]

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

=== Complexity
pass:v,q[Constant.]

=== Exception Safety
pass:v,q[Throws nothing.]

=== BNF
[,cpp]
----
path          = [ "/" ] segment *( "/" segment )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.3[3.3. Path (rfc3986)]



== Return Value

* `segments_view` 




