Stl Quick Reference Card Page 4

ADVERTISEMENT

4
STL Quick Reference – Version 1.29
April 20, 2007
[A4]
andomAccessIterator
void
bool
R
1
2
nputIterator
equal range returns iterators pair that
random shuffle
(
partial sort copy
includes
(
1
first1,
(
I
andomAccessIterator
lower bound and upper bound return.
nputIterator
nputIterator
first,
R
orwardIterator
orwardIterator
1
last1,
first,
I
I
andomAccessIterator
nputIterator
nputIterator
pair
,
F
F
result);
R
orwardIterator
2
first2,
last,
I
I
andomAccessIterator
nputIterator
equal range
(
first,
F
orwardIterator
2
last2);
resultFirst,
I
R
void
rand() returns double in [0 1)
andomAccessIterator
last,
F
random shuffle
resultLast,
(
R
ompare
bool
as above but using comp
andomAccessIterator
const
&
value);
nputIterator
T
comp);
C
first,
R
includes
(
1
first1,
orwardIterator
orwardIterator
I
andomAccessIterator
nputIterator
pair
,
last,
F
F
R
nth element
Let
= position
first,
1
last1,
orwardIterator
I
andomGenerator
nputIterator
equal range
(
first,
rand);
partitions [first last) into:
= [first position),
F
R
2
first2,
orwardIterator
I
nputIterator
idirectionalIterator
,
= [position + 1 last) such that
last,
F
2
last2,
I
begin with true
ompare
B
.
idirectionalIterator
const
&
value,
T
comp);
C
ompare
partition
(
first,
B
idirectionalIterator
void
comp);
utputIterator
C
last,
B
nth element
,
past end
(
O
redicate
1
2
nputIterator
andomAccessIterator
7.5
pred);
P
set union
(
1
first1,
first,
I
R
nputIterator
andomAccessIterator
idirectionalIterator
1
last1,
position,
I
R
begin with true
B
andomAccessIterator
nputIterator
4.3.2
Merge
2
first2,
stable partition
last);
I
(
R
nputIterator
idirectionalIterator
2
last2,
I
first,
B
utputIterator
void
as above but using comp(
)
Assuming
= [first
last
) and
idirectionalIterator
1
1
1
result);
O
last,
nth element
B
(
= [first
last
) are sorted, stably merge them
redicate
2
2
2
andomAccessIterator
utputIterator
into [result result +
) where
=
+
.
pred);
P
first,
R
1
2
as above but using comp
O
andomAccessIterator
nputIterator
utputIterator
position,
set union
R
(
1
first1,
I
andomAccessIterator
O
nputIterator
4.3
Sort and Application
nputIterator
last,
R
merge
1
last1,
(
1
first1,
I
ompare
I
nputIterator
nputIterator
comp);
andomAccessIterator
C
2
first2,
1
last1,
I
I
nputIterator
nputIterator
sort
void
(
first,
R
andomAccessIterator
2
last2,
2
first2,
I
I
utputIterator
4.3.1
Binary Search
nputIterator
last);
R
result,
2
last2,
O
I
ompare
andomAccessIterator
utputIterator
sort
comp);
void
(
first,
result);
C
R
bool
O
andomAccessIterator
orwardIterator
utputIterator
utputIterator
last,
binary search
R
(
first,
F
,
past end
ompare
O
orwardIterator
O
1
2
nputIterator
nputIterator
7.3
comp);
C
last,
F
set intersection
(
1
first1,
merge
I
(
1
first1,
I
nputIterator
nputIterator
const
&
value);
T
void
1
last1,
I
1
last1,
I
andomAccessIterator
nputIterator
nputIterator
stable sort
(
first,
2
first2,
R
bool
I
2
first2,
I
andomAccessIterator
orwardIterator
nputIterator
nputIterator
last);
binary search
(
first,
2
last2,
R
F
I
2
last2,
I
orwardIterator
utputIterator
utputIterator
last,
result);
F
O
result,
void
O
ompare
andomAccessIterator
utputIterator
const
&
value,
T
stable sort
comp);
(
first,
C
R
ompare
as above but using comp
O
andomAccessIterator
nputIterator
comp);
C
last,
set intersection
R
(
1
first1,
I
void
ranges [first,middle) [middle,last)
ompare
orwardIterator
nputIterator
comp);
C
1
last1,
F
inplace merge
(
into [first,last)
I
orwardIterator
nputIterator
idirectionalIterator
lower bound
(
first,
2
first2,
F
first,
I
B
void
[first,middle) sorted,
orwardIterator
nputIterator
idirectionalIterator
last,
2
last2,
partial sort
F
middle,
I
(
[middle,last) eq-greater
B
utputIterator
idirectionalIterator
andomAccessIterator
const
&
value);
result,
T
last);
O
first,
B
R
ompare
andomAccessIterator
comp);
C
middle,
ForwardIterator
R
andomAccessIterator
orwardIterator
void
as above but using comp
utputIterator
last);
lower bound
(
first,
R
F
inplace merge
,
past end
(
O
orwardIterator
1
2
nputIterator
idirectionalIterator
last,
F
set difference
(
1
first1,
void
as above but using comp(
)
first,
I
B
idirectionalIterator
nputIterator
const
&
value,
T
partial sort
1
last1,
(
middle,
I
ompare
B
andomAccessIterator
idirectionalIterator
nputIterator
comp);
C
2
first2,
first,
last,
I
R
B
andomAccessIterator
ompare
nputIterator
orwardIterator
2
last2,
middle,
comp);
I
R
C
F
andomAccessIterator
utputIterator
orwardIterator
result);
last,
upper bound
O
R
(
first,
F
ompare
orwardIterator
4.3.3
Functions on Sets
utputIterator
comp);
C
last,
F
as above but using comp
O
nputIterator
andomAccessIterator
const
&
value);
T
set difference
(
1
first1,
post last sorted
I
R
Can work on sorted associcative containers (see
nputIterator
partial sort copy
(
ForwardIterator
1
last1,
I
2.7). For multiset the interpretation of —
nputIterator
orwardIterator
nputIterator
first,
upper bound
(
first,
union, intersection and difference is by:
2
first2,
I
F
I
nputIterator
orwardIterator
nputIterator
maximum, minimum and substraction of
last,
last,
2
last2,
I
F
I
andomAccessIterator
utputIterator
occurrences respectably.
resultFirst,
const
&
value,
result,
R
T
O
andomAccessIterator
ompare
ompare
Let
= [first last ) for = 1 2.
resultLast);
comp);
comp);
R
C
C
Yotam Medini c 1998-2007

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 8