:relfileprefix: ../../../
[#768BBA857B242FF8B2570745E496E2C65ECE4056]

= Function segments_ref::insert

pass:v,q[Insert segments]


== Synopsis

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

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class FwdIt>
xref:boost/urls/segments_base.adoc[segments_base]::xref:boost/urls/segments_base/iterator.adoc[iterator]
insert(
    xref:boost/urls/segments_base.adoc[segments_base]::xref:boost/urls/segments_base/iterator.adoc[iterator] before,
    FwdIt first,
    FwdIt last);
----

== Description

pass:v,q[This function inserts the segments in] pass:v,q[a range before the specified position.]
pass:v,q[Reserved characters in the list are]
pass:v,q[automatically escaped.]
pass:v,q[All iterators that are equal to]
pass:v,q[`before` or come after are invalidated.]
[NOTE]
pass:v,q[None of the character buffers referenced]
pass:v,q[by the range may overlap the character]
pass:v,q[buffer of the underlying url, or else]
pass:v,q[the behavior is undefined.]

=== Mandates
[,cpp]
----
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true
----

=== Complexity
pass:v,q[Linear in `std::distance( first, last ) + this->url().encoded_resource().size()`.]

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



== Return Value

* `iterator` 


== Parameters

|===
| Name | Type 

| *before*
| `iterator`

| *first*
| `FwdIt`

| *last*
| `FwdIt`

|===



