Title: Theory / Unimportant / CS / Programming / C++ / Manual / IV STL / 32 Algorithms
Tags: automatedNewLineAfterCommaSpace
On every note of this deck, unless a note says otherwise:
Language: c++
Context: stl
Chapter: 32

Question: How does stl represents input range
Answer: with the form [b : e)
Page: 928
Chapter: 32
Section: 2
Context: c++

Question: How does stl represents output range
Answer: with an iterator on its first element
Page: 928
Chapter: 32
Section: 2
Context: c++

Question: When a `find` method return when the value is not found
Answer: returning the element after the end of the search range
Page: 928
Chapter: 32
Section: 2
Context: c++, stl

Question: What to do if no stl function do the job you want
Answer: Search for an extension of STL already existing and well tested
Page: 930
Chapter: 32
Section: 2
Context: c++

Instruction: foo_if
Page: 930
Section: 2
Returns: a function similar to foo, but taking a predicate as argument
Example: find and find_if search a specific element/an element satisfying a condition

Instruction: for_each(
  b,
  e,
  f
)
Page: 932
Section: 4.1
Returns: Apply f to each element of [b, e)

Instruction: all_of(b, e, f)
Page: 932
Section: 4.1
Returns: Whether f return true for each element in [b : e)

Instruction: any_of(
  b,
  e,
  f
)
Page: 932
Section: 4.1
Returns: Whether f returns true for any element in [b : e)

Instruction: none_of(
  b,
  e,
  f
)
Page: 932
Section: 4.1
Returns: Whether f returns true for no elements in [b : e)

Instruction: count_if(b, e, f)
Page: 932
Section: 4.3
Returns: The number of elements in [b : e) satisfying f
Variables: f a predicate

Instruction: count(b, e, v)
Page: 932
Section: 4.3
Returns: The number of elements in [b : e) equal to v

Instruction: find(
  b,
  e,
  v
)
Page: 932
Section: 4.4
Returns: The first element of [b : e) equals to v

Instruction: find_if(
  b,
  e,
  f
)
Page: 932
Section: 4.4
Returns: The first element of [b : e) satisfies f

Instruction: find_if_not(
  b,
  e,
  f
)
Page: 932
Section: 4.4
Returns: The first element of [b : e) not satisfiying f

Instruction: find_first_of(
  b,
  e,
  b2,
  e2
)
Page: 932
Section: 4.4
Returns: The first element of [b : e) belonging to [b2, e2)

Instruction: find_first_of(
  b,
  e,
  b2,
  e2,
  f
)
Page: 932
Section: 4.4
Returns: The first element elt of [b : e) such that there exists elt2 in [b2 : e2) such that f(  elt, elt2)

Instruction: adjacent_find(
  b,
  e
)
Page: 932
Section: 4.4
Returns: Pointer p to the first element of [b : e) such that *p == *(  p+1)

Instruction: adjacent_find(
  b,
  e,
  f
)
Page: 932
Section: 4.4
Returns: Pointer p to the first element of [b : e) such that f(  *p, *(  p+1))

Instruction: find_end(
  b,
  e,
  b2,
  e2,
  f
)
Page: 932
Section: 4.4
Returns: Pointer p to the last element of [b : e) where there is p2 in [b2 : e2) such that f(  *p, *p2)

Instruction: find_end(
  b,
  e,
  b2,
  e2
)
Page: 932
Section: 4.4
Returns: Pointer p to the last element of [b : e) where there is p2 in [b2 : e2) such that *p == *p2

Instruction: equal(
  b,
  e,
  b2
)
Page: 932
Section: 4.5
Returns: Whether for each i in [0, b-e), *b+i == *b2+i

Instruction: equal(
  b,
  e,
  b2,
  f
)
Page: 932
Section: 4.5
Returns: Whether for each i in [0, b-e), f(  *b+i, *b2+i)

Instruction: mistmatch(
  b,
  e,
  b2
)
Page: 932
Section: 4.5
Returns: Pair of pointers to the first difference in [b : e) and [b2 : ...)

Instruction: mistmatch(
  b,
  e,
  b2,
  f
)
Page: 932
Section: 4.5
Returns: Pair of pointers to the first difference in [b : e) and [b2 : ...) according to f

Instruction: search(
  b,
  e,
  b2,
  e2
)
Page: 932
Section: 4.6
Returns: Pointer to the start of a copy of [b2 : e2) inside of [b : e)

Instruction: search(
  b,
  e,
  b2,
  e2,
  f
)
Page: 932
Section: 4.6
Returns: Pointer to the start of a copy of [b2 : e2) inside of [b : e) according to equality f

Instruction: search_n(
  b,
  e,
  n,
  v,
  f
)
Page: 932
Section: 4.6
Returns: Pointer to the start of the first sequence of n v inside of [b : e) according to equality f

Instruction: search_n(
  b,
  e,
  n,
  v
)
Page: 932
Section: 4.6
Returns: Pointer to the start of the first sequence of n v inside of [b : e)

Instruction: transform(
  b,
  e,
  out,
  f
)
Page: 935
Effect: The sequence starting at out contains
f(*b), f(*(b+1)), ..., f(*(e-1))
Section: 4.6

Instruction: transform(
  b,
  e,
  b2,
  out,
  f
)
Page: 935
Effect: The sequence starting at out contains
f(*b, *b2), f(*(b+1), f*(b2+1)), ..., f(*(e-1), *(b2+(e-b)))
Section: 4.6

Instruction: copy(
  b,
  e,
  out
)
Page: 935
Effect: copy [b: e) starting at out
Section: 5.1

Instruction: copy_if(
  b,
  e,
  out,
  f
)
Page: 935
Effect: copy elements of [b: e) satisfying f starting at out
Section: 5.1

Instruction: copy_n(
  b,
  n,
  out
)
Page: 935
Effect: copy [b: b+n) starting at out
Section: 5.1

Instruction: copy_backward(
  b,
  e,
  out
)
Page: 935
Effect: copy [b: e) starting at out in reverse order
Section: 5.1

Instruction: move_backward(
  b,
  e,
  out
)
Page: 935
Effect: move [b: e) to [out, out + (e-b)) in reverse order
Section: 5.1

Instruction: move(
  b,
  e,
  out
)
Page: 935
Effect: move [b: e) to [out, out + (e-b))
Section: 5.1

Instruction: unique(
  b,
  e,
  eq_predicate
)
Page: 935
Effect: Remove duplicates element in [b, e) according to eq_predicate.
Section: 5.2

Instruction: unique(
  b,
  e
)
Page: 935
Effect: Remove duplicates element in [b, e)
Section: 5.2

Instruction: unique_copy(
  b,
  e,
  out
)
Page: 935
Effect: copy [b, e) starting at out, don't copy adjacent duplicate
Section: 5.2

Instruction: unique_copy(
  b,
  e,
  out,
  eq_predicate
)
Page: 935
Effect: copy [b, e) starting at out, don't copy adjacent duplicate according to eq_prediacte
Section: 5.2

Instruction: reverse(
  b,
  e
)
Page: 938
Effect: Reverse the order of elements in [ b : e )
Section: 5.2

Instruction: reverse_copy(
  b,
  e,
  out
)
Page: 938
Effect: copy [b : e) in reverse order starting at out
Section: 5.2
Returns: pointer one after the end of the copy

Instruction: remove(
  b,
  e,
  value
)
Page: 938
Effect: Moves elements with value to the end of the sequence
Section: 5.2
Returns: the pointer to the first element with value

Instruction: remove_if(
  b,
  e,
  f
)
Page: 938
Effect: Moves elements satisfying f to the end of the sequence
Section: 5.2
Returns: the pointer to the first element satisfying f

Instruction: replace(
  b,
  e,
  v,
  v2
)
Page: 938
Effect: Replaces v by v2 in [b: e)
Section: 5.2

Instruction: replace_if(
  b,
  e,
  f,
  v
)
Page: 938
Effect: Replaces elements satisfying f by v in [b: e)
Section: 5.2

Instruction: replace_copy_if(
  b,
  e,
  out,
  f,
  v
)
Page: 938
Effect: copy [b, e) starting at out, replacing element satisfying f by v
Section: 5.2
Returns: pointer one after the last element copied

Instruction: replace_copy(
  b,
  e,
  out,
  v,
  v
)
Page: 938
Effect: copy [b, e) starting at out, replacing v by v2
Section: 5.2
Returns: pointer one after the last element copied