This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

49
cppdraft/alg/c/library.md Normal file
View File

@@ -0,0 +1,49 @@
[alg.c.library]
# 26 Algorithms library [[algorithms]](./#algorithms)
## 26.13 C library algorithms [alg.c.library]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14449)
[*Note [1](#note-1)*:
The header [<cstdlib>](cstdlib.syn#header:%3ccstdlib%3e "17.2.2Header <cstdlib> synopsis[cstdlib.syn]") declares the functions described in this subclause[.](#1.sentence-1)
— *end note*]
[🔗](#lib:bsearch)
`void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
c-compare-pred* compar);
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
compare-pred* compar);
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
c-compare-pred* compar);
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
compare-pred* compar);
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14471)
*Preconditions*: For qsort, the objects in the array pointed to by base are of trivially copyable type[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14476)
*Effects*: These functions have the semantics specified in the C standard library[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/algorithms.tex#L14480)
*Throws*: Any exception thrown by compar ([[res.on.exception.handling]](res.on.exception.handling "16.4.6.14Restrictions on exception handling"))[.](#4.sentence-1)
See also: ISO/IEC 9899:2024, 7.24.5