STL

T

Tony Johansson

Hello!

One easy question.

In STL you have some specific funktions that are called algoritmer for
example front_inserter and back_inserter.
You have also some ordinary funtions for example insert and erase just to
mention some.

These functions are doings different things of cource but is it any major
differens between algoritmer and the ordinary funktions that exist in STL.

//Tony
 
B

ben

In STL you have some specific funktions that are called algoritmer for
example front_inserter and back_inserter.
You have also some ordinary funtions for example insert and erase just to
mention some.

These functions are doings different things of cource but is it any major
differens between algoritmer and the ordinary funktions that exist in STL.

STL provides a set of functions to manipulate containers (sort, copy,
insert, erase, etc.) They work with iterators. There are another set of
helper function usually not directly called from a user but used along with
the former set of functions mentioned to specify tasks. These helper
functions usually work with the container itself, or the individual
elements.

Example:

copy(phone_book.begin(), phone_book.end(),
back_inserter(new_phone_book));

This is a common example. But a standalone back_inserter:

deque<int>::iterator itr = back_inserter(new_phone_book);

would be very uncommon.

ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top