:relfileprefix: ../../../
[#119DC0C2924F27E7945E850B01F095000E7BC905]

= Function segments_base::front

pass:v,q[Return the first segment]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
string
front() const noexcept;
----

== Description

pass:v,q[This function returns a string with the] pass:v,q[first segment of the path without any]
pass:v,q[leading or trailing '/' separators.]
pass:v,q[Any percent-escapes in the string are]
pass:v,q[decoded first.]

=== Preconditions
[,cpp]
----
this->empty() == false
----

=== Effects
[,cpp]
----
return *begin();
----

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

=== Complexity
pass:v,q[Linear in `this->front().size()`.]

=== Exception Safety
pass:v,q[Calls to allocate may throw.]



== Return Value

* `string` 




