#567. STL-algorithm 常用函数

STL-algorithm 常用函数

当前没有测试数据。

排序与排列

  • sort(begin, end)
  • stable_sort(begin, end)
  • partial_sort(begin, middle, end)
  • nth_element(begin, nth, end)
  • is_sorted(begin, end)
  • is_sorted_until(begin, end)
  • next_permutation(begin, end)
  • prev_permutation(begin, end)

查找

  • find(begin, end, value)
  • find_if(begin, end, pred)
  • find_if_not(begin, end, pred)
  • adjacent_find(begin, end)
  • count(begin, end, value)
  • count_if(begin, end, pred)
  • search(begin1, end1, begin2, end2)
  • search_n(begin, end, count, value)
  • binary_search(begin, end, value)
  • lower_bound(begin, end, value)
  • upper_bound(begin, end, value)
  • equal_range(begin, end, value)

集合操作

  • merge(begin1, end1, begin2, end2, output)
  • includes(begin1, end1, begin2, end2)
  • set_union(begin1, end1, begin2, end2, output)
  • set_intersection(begin1, end1, begin2, end2, output)
  • set_difference(begin1, end1, begin2, end2, output)
  • set_symmetric_difference(begin1, end1, begin2, end2, output)

修改

  • copy(begin, end, output)
  • copy_n(begin, n, output)
  • copy_if(begin, end, output, pred)
  • copy_backward(begin, end, output)
  • move(begin, end, output)
  • move_backward(begin, end, output)
  • fill(begin, end, value)
  • fill_n(output, n, value)
  • transform(begin, end, output, func)
  • replace(begin, end, old_value, new_value)
  • replace_if(begin, end, pred, new_value)
  • replace_copy(begin, end, output, old_value, new_value)
  • replace_copy_if(begin, end, output, pred, new_value)
  • swap_ranges(begin1, end1, begin2)
  • iter_swap(iterator1, iterator2)
  • reverse(begin, end)
  • reverse_copy(begin, end, output)
  • rotate(begin, new_begin, end)
  • rotate_copy(begin, new_begin, end, output)
  • shuffle(begin, end, g)
  • random_shuffle(begin, end)

数值操作

  • accumulate(begin, end, init)
  • inner_product(begin1, end1, begin2, init)
  • partial_sum(begin, end, output)
  • adjacent_difference(begin, end, output)

比较

  • max(a, b)
  • min(a, b)
  • max_element(begin, end)
  • min_element(begin, end)
  • lexicographical_compare(begin1, end1, begin2, end2)
  • equal(begin1, end1, begin2)
  • mismatch(begin1, end1, begin2)