[#boost-urls-segments_view-2constructor-0a] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/segments_view.adoc[segments_view]::segments_view :relfileprefix: ../../../ :mrdocs: Constructor == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_view.hpp#L211[boost/url/segments_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- segments_view( xref:boost/urls/segments_base/iterator.adoc[iterator] first, xref:boost/urls/segments_base/iterator.adoc[iterator] last) noexcept; ---- == Description This function creates a new xref:boost/urls/segments_view/2constructor-0c9.adoc[`segments_view`] from a pair of iterators referring to elements of another segments view. The resulting view references the same underlying character buffer as the original. The caller is responsible for ensuring that the lifetime of the original buffer extends until the constructed view is no longer referenced. == Example [,cpp] ---- segments_view ps( "/path/to/file.txt" ); segments_view sub( std::next(ps.begin()), ps.end()); // sub represents "to/file.txt" ---- == Preconditions The iterators must be valid and belong to the same xref:boost/urls/segments_view/2constructor-0c9.adoc[`segments_view`]. == Postconditions `sub.buffer()` references characters in the original `ps.buffer()`. == Complexity Linear in `sub.buffer()` == Exception Safety Throws nothing. == Parameters [cols=2] |=== | Name | Description | *first* | The beginning iterator. | *last* | The ending iterator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#