tmp/tmpwndvszpd/{from.md → to.md}
RENAMED
|
@@ -1,65 +1,37 @@
|
|
| 1 |
## C library algorithms <a id="alg.c.library">[[alg.c.library]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
The contents are the same as the Standard C library header `<stdlib.h>`
|
| 7 |
-
with the following exceptions:
|
| 8 |
-
|
| 9 |
-
The function signature:
|
| 10 |
-
|
| 11 |
-
``` cpp
|
| 12 |
-
bsearch(const void *, const void *, size_t, size_t,
|
| 13 |
-
int (*)(const void *, const void *));
|
| 14 |
-
```
|
| 15 |
-
|
| 16 |
-
is replaced by the two declarations:
|
| 17 |
-
|
| 18 |
-
``` cpp
|
| 19 |
-
extern "C" void* bsearch(const void* key, const void* base,
|
| 20 |
-
size_t nmemb, size_t size,
|
| 21 |
-
int (*compar)(const void*, const void*));
|
| 22 |
-
extern "C++" void* bsearch(const void* key, const void* base,
|
| 23 |
-
size_t nmemb, size_t size,
|
| 24 |
-
int (*compar)(const void*, const void*));
|
| 25 |
-
```
|
| 26 |
-
|
| 27 |
-
both of which have the same behavior as the original declaration.
|
| 28 |
-
|
| 29 |
-
The function signature:
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
```
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
``` cpp
|
| 39 |
-
extern "C" void qsort(void* base, size_t nmemb, size_t size,
|
| 40 |
-
int (*compar)(const void*, const void*));
|
| 41 |
-
extern "C++" void qsort(void* base, size_t nmemb, size_t size,
|
| 42 |
-
int (*compar)(const void*, const void*));
|
| 43 |
-
```
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
`base` are of trivial type.
|
| 48 |
|
| 49 |
-
|
| 50 |
-
`
|
| 51 |
-
[[res.on.exception.handling]]).
|
| 52 |
|
| 53 |
-
ISO C 7.
|
| 54 |
|
| 55 |
<!-- Link reference definitions -->
|
| 56 |
[alg.adjacent.find]: #alg.adjacent.find
|
| 57 |
[alg.all_of]: #alg.all_of
|
| 58 |
[alg.any_of]: #alg.any_of
|
| 59 |
[alg.binary.search]: #alg.binary.search
|
| 60 |
[alg.c.library]: #alg.c.library
|
|
|
|
| 61 |
[alg.copy]: #alg.copy
|
| 62 |
[alg.count]: #alg.count
|
| 63 |
[alg.equal]: #alg.equal
|
| 64 |
[alg.fill]: #alg.fill
|
| 65 |
[alg.find]: #alg.find
|
|
@@ -77,10 +49,11 @@ ISO C 7.10.5.
|
|
| 77 |
[alg.none_of]: #alg.none_of
|
| 78 |
[alg.nonmodifying]: #alg.nonmodifying
|
| 79 |
[alg.nth.element]: #alg.nth.element
|
| 80 |
[alg.partitions]: #alg.partitions
|
| 81 |
[alg.permutation.generators]: #alg.permutation.generators
|
|
|
|
| 82 |
[alg.random.shuffle]: #alg.random.shuffle
|
| 83 |
[alg.remove]: #alg.remove
|
| 84 |
[alg.replace]: #alg.replace
|
| 85 |
[alg.reverse]: #alg.reverse
|
| 86 |
[alg.rotate]: #alg.rotate
|
|
@@ -90,34 +63,42 @@ ISO C 7.10.5.
|
|
| 90 |
[alg.sorting]: #alg.sorting
|
| 91 |
[alg.swap]: #alg.swap
|
| 92 |
[alg.transform]: #alg.transform
|
| 93 |
[alg.unique]: #alg.unique
|
| 94 |
[algorithm.stable]: library.md#algorithm.stable
|
|
|
|
| 95 |
[algorithms]: #algorithms
|
| 96 |
[algorithms.general]: #algorithms.general
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
[bidirectional.iterators]: iterators.md#bidirectional.iterators
|
| 98 |
[binary.search]: #binary.search
|
| 99 |
[class.conv]: special.md#class.conv
|
| 100 |
[containers]: containers.md#containers
|
| 101 |
[conv]: conv.md#conv
|
| 102 |
[conv.integral]: conv.md#conv.integral
|
| 103 |
-
[
|
| 104 |
-
[copyconstructible]: #copyconstructible
|
| 105 |
[equal.range]: #equal.range
|
|
|
|
| 106 |
[forward.iterators]: iterators.md#forward.iterators
|
| 107 |
[function.objects]: utilities.md#function.objects
|
| 108 |
[includes]: #includes
|
| 109 |
[input.iterators]: iterators.md#input.iterators
|
|
|
|
|
|
|
| 110 |
[is.heap]: #is.heap
|
| 111 |
[is.sorted]: #is.sorted
|
| 112 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 113 |
-
[
|
| 114 |
[lower.bound]: #lower.bound
|
| 115 |
[make.heap]: #make.heap
|
| 116 |
[mismatch]: #mismatch
|
| 117 |
-
[moveassignable]: #moveassignable
|
| 118 |
-
[moveconstructible]: #moveconstructible
|
| 119 |
[multiset]: containers.md#multiset
|
| 120 |
[output.iterators]: iterators.md#output.iterators
|
| 121 |
[partial.sort]: #partial.sort
|
| 122 |
[partial.sort.copy]: #partial.sort.copy
|
| 123 |
[pop.heap]: #pop.heap
|
|
@@ -132,12 +113,17 @@ ISO C 7.10.5.
|
|
| 132 |
[set.union]: #set.union
|
| 133 |
[sort]: #sort
|
| 134 |
[sort.heap]: #sort.heap
|
| 135 |
[stable.sort]: #stable.sort
|
| 136 |
[swappable.requirements]: library.md#swappable.requirements
|
| 137 |
-
[tab:algorithms.hdr.cstdlib]: #tab:algorithms.hdr.cstdlib
|
| 138 |
[tab:algorithms.summary]: #tab:algorithms.summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
[upper.bound]: #upper.bound
|
| 140 |
|
| 141 |
[^1]: The decision whether to include a copying version was usually
|
| 142 |
based on complexity considerations. When the cost of doing the
|
| 143 |
operation dominates the cost of copy, the copying version is not
|
|
@@ -150,5 +136,7 @@ ISO C 7.10.5.
|
|
| 150 |
|
| 151 |
[^3]: `move_backward` should be used instead of move when last is in the
|
| 152 |
range \[`result - (last - first)`, `result`).
|
| 153 |
|
| 154 |
[^4]: The use of fully closed ranges is intentional.
|
|
|
|
|
|
|
|
|
| 1 |
## C library algorithms <a id="alg.c.library">[[alg.c.library]]</a>
|
| 2 |
|
| 3 |
+
[*Note 1*: The header `<cstdlib>` ([[cstdlib.syn]]) declares the
|
| 4 |
+
functions described in this subclause. — *end note*]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
``` cpp
|
| 7 |
+
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 8 |
+
c-compare-pred* compar);
|
| 9 |
+
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 10 |
+
compare-pred* compar);
|
| 11 |
+
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
|
| 12 |
+
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
|
| 13 |
```
|
| 14 |
|
| 15 |
+
*Effects:* These functions have the semantics specified in the C
|
| 16 |
+
standard library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
*Remarks:* The behavior is undefined unless the objects in the array
|
| 19 |
+
pointed to by `base` are of trivial type.
|
|
|
|
| 20 |
|
| 21 |
+
*Throws:* Any exception thrown by
|
| 22 |
+
`compar()` ([[res.on.exception.handling]]).
|
|
|
|
| 23 |
|
| 24 |
+
ISO C 7.22.5.
|
| 25 |
|
| 26 |
<!-- Link reference definitions -->
|
| 27 |
[alg.adjacent.find]: #alg.adjacent.find
|
| 28 |
[alg.all_of]: #alg.all_of
|
| 29 |
[alg.any_of]: #alg.any_of
|
| 30 |
[alg.binary.search]: #alg.binary.search
|
| 31 |
[alg.c.library]: #alg.c.library
|
| 32 |
+
[alg.clamp]: #alg.clamp
|
| 33 |
[alg.copy]: #alg.copy
|
| 34 |
[alg.count]: #alg.count
|
| 35 |
[alg.equal]: #alg.equal
|
| 36 |
[alg.fill]: #alg.fill
|
| 37 |
[alg.find]: #alg.find
|
|
|
|
| 49 |
[alg.none_of]: #alg.none_of
|
| 50 |
[alg.nonmodifying]: #alg.nonmodifying
|
| 51 |
[alg.nth.element]: #alg.nth.element
|
| 52 |
[alg.partitions]: #alg.partitions
|
| 53 |
[alg.permutation.generators]: #alg.permutation.generators
|
| 54 |
+
[alg.random.sample]: #alg.random.sample
|
| 55 |
[alg.random.shuffle]: #alg.random.shuffle
|
| 56 |
[alg.remove]: #alg.remove
|
| 57 |
[alg.replace]: #alg.replace
|
| 58 |
[alg.reverse]: #alg.reverse
|
| 59 |
[alg.rotate]: #alg.rotate
|
|
|
|
| 63 |
[alg.sorting]: #alg.sorting
|
| 64 |
[alg.swap]: #alg.swap
|
| 65 |
[alg.transform]: #alg.transform
|
| 66 |
[alg.unique]: #alg.unique
|
| 67 |
[algorithm.stable]: library.md#algorithm.stable
|
| 68 |
+
[algorithm.syn]: #algorithm.syn
|
| 69 |
[algorithms]: #algorithms
|
| 70 |
[algorithms.general]: #algorithms.general
|
| 71 |
+
[algorithms.parallel]: #algorithms.parallel
|
| 72 |
+
[algorithms.parallel.defns]: #algorithms.parallel.defns
|
| 73 |
+
[algorithms.parallel.exceptions]: #algorithms.parallel.exceptions
|
| 74 |
+
[algorithms.parallel.exec]: #algorithms.parallel.exec
|
| 75 |
+
[algorithms.parallel.overloads]: #algorithms.parallel.overloads
|
| 76 |
+
[algorithms.parallel.user]: #algorithms.parallel.user
|
| 77 |
+
[algorithms.requirements]: #algorithms.requirements
|
| 78 |
[bidirectional.iterators]: iterators.md#bidirectional.iterators
|
| 79 |
[binary.search]: #binary.search
|
| 80 |
[class.conv]: special.md#class.conv
|
| 81 |
[containers]: containers.md#containers
|
| 82 |
[conv]: conv.md#conv
|
| 83 |
[conv.integral]: conv.md#conv.integral
|
| 84 |
+
[cstdlib.syn]: language.md#cstdlib.syn
|
|
|
|
| 85 |
[equal.range]: #equal.range
|
| 86 |
+
[execpol]: utilities.md#execpol
|
| 87 |
[forward.iterators]: iterators.md#forward.iterators
|
| 88 |
[function.objects]: utilities.md#function.objects
|
| 89 |
[includes]: #includes
|
| 90 |
[input.iterators]: iterators.md#input.iterators
|
| 91 |
+
[intro.execution]: intro.md#intro.execution
|
| 92 |
+
[intro.progress]: intro.md#intro.progress
|
| 93 |
[is.heap]: #is.heap
|
| 94 |
[is.sorted]: #is.sorted
|
| 95 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 96 |
+
[iterator.requirements.general]: iterators.md#iterator.requirements.general
|
| 97 |
[lower.bound]: #lower.bound
|
| 98 |
[make.heap]: #make.heap
|
| 99 |
[mismatch]: #mismatch
|
|
|
|
|
|
|
| 100 |
[multiset]: containers.md#multiset
|
| 101 |
[output.iterators]: iterators.md#output.iterators
|
| 102 |
[partial.sort]: #partial.sort
|
| 103 |
[partial.sort.copy]: #partial.sort.copy
|
| 104 |
[pop.heap]: #pop.heap
|
|
|
|
| 113 |
[set.union]: #set.union
|
| 114 |
[sort]: #sort
|
| 115 |
[sort.heap]: #sort.heap
|
| 116 |
[stable.sort]: #stable.sort
|
| 117 |
[swappable.requirements]: library.md#swappable.requirements
|
|
|
|
| 118 |
[tab:algorithms.summary]: #tab:algorithms.summary
|
| 119 |
+
[tab:copyassignable]: #tab:copyassignable
|
| 120 |
+
[tab:copyconstructible]: #tab:copyconstructible
|
| 121 |
+
[tab:lessthancomparable]: #tab:lessthancomparable
|
| 122 |
+
[tab:moveassignable]: #tab:moveassignable
|
| 123 |
+
[tab:moveconstructible]: #tab:moveconstructible
|
| 124 |
+
[thread.thread.class]: thread.md#thread.thread.class
|
| 125 |
[upper.bound]: #upper.bound
|
| 126 |
|
| 127 |
[^1]: The decision whether to include a copying version was usually
|
| 128 |
based on complexity considerations. When the cost of doing the
|
| 129 |
operation dominates the cost of copy, the copying version is not
|
|
|
|
| 136 |
|
| 137 |
[^3]: `move_backward` should be used instead of move when last is in the
|
| 138 |
range \[`result - (last - first)`, `result`).
|
| 139 |
|
| 140 |
[^4]: The use of fully closed ranges is intentional.
|
| 141 |
+
|
| 142 |
+
[^5]: This behavior intentionally differs from `max_element()`.
|