[#boost-urls-segments_encoded_view-2constructor-0e0]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/segments_encoded_view.adoc[segments&lowbar;encoded&lowbar;view]::segments&lowbar;encoded&lowbar;view
:relfileprefix: ../../../
:mrdocs:

Constructor

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/segments_encoded_view.hpp#L213[boost&sol;url&sol;segments&lowbar;encoded&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
segments&lowbar;encoded&lowbar;view(
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] first,
    xref:boost/urls/segments_encoded_base/iterator.adoc[iterator] last) noexcept;
----

== Description

This function creates a new xref:boost/urls/segments_encoded_view/2constructor-0b1.adoc[`segments&lowbar;encoded&lowbar;view`] from a pair of iterators referring to elements of another encoded segments view&period; The resulting view references the same underlying character buffer as the original&period;

The caller is responsible for ensuring that the lifetime of the original buffer extends until the constructed view is no longer referenced&period;

== Example

[,cpp]
----
segments_encoded_view ps( "/path/to/file.txt" );

segments_encoded_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_encoded_view/2constructor-0b1.adoc[`segments&lowbar;encoded&lowbar;view`]&period;

== Postconditions

`sub&period;buffer()` references characters in the original `ps&period;buffer()`&period;

== Complexity

Linear in `sub&period;buffer()`

== Exception Safety

Throws nothing&period;

== Parameters

[cols="1,4"]
|===
|Name|Description

| *first*
| The beginning iterator&period;
| *last*
| The ending iterator&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
