Skip to content

关于本章

本章描述C++ algorithms library。

cppreference Algorithms library

The algorithms library defines functions for a variety of purposes (e.g. searching, sorting, counting, manipulating) that operate on ranges of elements. Note that a range is defined as [first, last) where last refers to the element past the last element to inspect or modify.

NOTE: 关于range,参见C++\Library\Standard-library\STL\Range

Non-modifying sequence operations

Defined in header <algorithm>

Modifying sequence operations

Defined in header <algorithm>

Partitioning operations

Defined in header <algorithm>

Sorting operations

Defined in header <algorithm>

Binary search operations (on sorted ranges)

Defined in header <algorithm>

Other operations on sorted ranges

Defined in header <algorithm>

Set operations (on sorted ranges)

Defined in header <algorithm>

Heap operations

Defined in header <algorithm>

Minimum/maximum operations

Defined in header <algorithm>

Comparison operations

Permutation operations

Numeric operations

Defined in header <numeric>

Operations on uninitialized memory

Defined in header <memory>

Implementation

gcc libstdc++

gcc/libstdc++-v3/include/bits/stl_algo.h

llvm libcxx

libcxx/include/algorithm

MSVC stdlib

MSVC stdlib