home | login | register | DMCA | contacts | help | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z


my bookshelf | genres | recommend | rating of books | rating of authors | reviews | new | | collections | | | add
fantasy
space fantasy
fantasy is horrors
heroic
prose
  military
  child
  russian
detective
  action
  child
  ironical
  historical
  political
western
adventure
adventure (child)
child's stories
love
religion
antique
Scientific literature
biography
business
home pets
animals
art
history
computers
linguistics
mathematics
religion
home_garden
sport
technique
publicism
philosophy
chemistry
close

Loading...


Example

Insert a range of elements into a list.

list L;

L.push_front(3);

insert_iterator > ii(L, L.begin());

*ii++ = 0;

*ii++ = 1;

*ii++ = 2;

copy(L.begin(), L.end(), ostream_iterator(cout, " "));

// The values that are printed are 0 1 2 3.

Merge two sorted lists, inserting the resulting range into a set. Note that a set never contains duplicate elements.

int main() {

const int N = 6;

int A1[N] = {1, 3, 5, 7, 9, 11};

int A2[N] = {1, 2, 3, 4, 5, 6};

set result;

merge (A1, A1 + N, A2, A2 + N,

inserter(result, result.begin()));

copy(result.begin(), result.end(), ostream_iterator(cout, " "));

cout << endl;

// The output is "1 2 3 4 5 6 7 9 11".

}


Description | Standard Template Library Programmer`s Guide | Definition







Loading...