[#bsl-slist-insert-0c]
= xref:bsl.adoc[bsl]::xref:bsl/slist.adoc[slist]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

Declared in `&lt;bslstp&lowbar;slist&period;h&gt;`

Insert `&lowbar;&lowbar;x` before `&lowbar;&lowbar;pos` and return an iterator to the new element&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/slist/iterator.adoc[iterator]
xref:bsl/slist/insert-0e.adoc[insert](
    xref:bsl/slist/iterator.adoc[iterator] &lowbar;&lowbar;pos,
    xref:bsl/slist/value_type.adoc[value&lowbar;type] const& &lowbar;&lowbar;x = &lowbar;Tp());
----

[.small]#xref:bsl/slist/insert-0e.adoc[_» more&period;&period;&period;_]#

Insert `&lowbar;&lowbar;n` copies of `&lowbar;&lowbar;x` before `&lowbar;&lowbar;pos`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
xref:bsl/slist/insert-08.adoc[insert](
    xref:bsl/slist/iterator.adoc[iterator] &lowbar;&lowbar;pos,
    xref:bsl/slist/size_type.adoc[size&lowbar;type] &lowbar;&lowbar;n,
    xref:bsl/slist/value_type.adoc[value&lowbar;type] const& &lowbar;&lowbar;x);
----

[.small]#xref:bsl/slist/insert-08.adoc[_» more&period;&period;&period;_]#

Insert the specified range before `&lowbar;&lowbar;pos`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class &lowbar;InIter&gt;
void
xref:bsl/slist/insert-0f.adoc[insert](
    xref:bsl/slist/iterator.adoc[iterator] &lowbar;&lowbar;pos,
    &lowbar;InIter &lowbar;&lowbar;first,
    &lowbar;InIter &lowbar;&lowbar;last);
----

[.small]#xref:bsl/slist/insert-0f.adoc[_» more&period;&period;&period;_]#

== Return Value

iterator referring to the inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *&lowbar;&lowbar;pos*
| position before which to insert
| *&lowbar;&lowbar;x*
| value to insert
| *&lowbar;&lowbar;n*
| number of copies to insert
| *&lowbar;&lowbar;first*
| beginning of the range to insert
| *&lowbar;&lowbar;last*
| end of the range to insert (exclusive)
|===


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