標準ライブラリヘッダ <cstdlib>
提供: cppreference.com
このヘッダは元々 C 標準ライブラリに <stdlib.h>
として存在していました。
このヘッダは雑多なユーティリティを提供します。 ここに定義されているシンボルはいくつかのライブラリコンポーネントで使用されます。
型 | ||
std::div 関数の戻り値の構造体型 (typedef) | ||
std::ldiv 関数の戻り値の構造体型 (typedef) | ||
(C++11) |
std::lldiv 関数の戻り値の構造体型 (typedef) | |
sizeof 演算子によって返される符号なし整数型 (typedef) | ||
マクロ定数 | ||
プログラム実行ステータスを表します (マクロ定数) | ||
MB_CUR_MAX |
現在のロケールにおけるマルチバイト文字の最大バイト数 (マクロ定数) | |
処理系定義のヌルポインタ定数 (マクロ定数) | ||
std::rand によって生成可能な最大値 (マクロ定数) | ||
関数 | ||
プロセス制御 | ||
(クリーンアップせずに) プログラムを異常終了させます (関数) | ||
クリーンアップをしてプログラムを正常終了させます (関数) | ||
(C++11) |
完全なクリーンアップをせずにプログラムを素早く終了させます (関数) | |
(C++11) |
クリーンアップせずにプログラムを正常終了させます (関数) | |
std::exit が呼ばれたときに呼ばれる関数を登録します (関数) | ||
(C++11) |
quick_exit が呼ばれた時に呼��れる関数を登録します (関数) | |
ホスト環境のコマンドプロセッサを呼び出します (関数) | ||
環境変数のリストにアクセスします (関数) | ||
メモリ管理 | ||
メモリを確保します (関数) | ||
(C++17) |
アラインされたメモリを確保します (関数) | |
メモリを確保してゼロクリアします (関数) | ||
以前に確保されたメモリブロックを拡張し、または収縮します (関数) | ||
以前に確保されたメモリを解放します (関数) | ||
数値文字列変換 | ||
バイト文字列を浮動小数点値に変換します (関数) | ||
(C++11) |
バイト文字列を整数値に変換します (関数) | |
(C++11) |
バイト文字列を整数値に変換します (関数) | |
(C++11) |
バイト文字列を符号なし整数値に変換します (関数) | |
バイト文字列を浮動小数点値に変換します (関数) | ||
ワイド文字列操作 | ||
次のマルチバイト文字のバイト数を返します (関数) | ||
次のマルチバイト文字をワイド文字に変換します (関数) | ||
ワイド文字をマルチバイト表現に変換します (関数) | ||
マルチバイト文字列をワイド文字列に変換します (関数) | ||
ワイド文字列をマルチバイト文字列に変換します (関数) | ||
雑多なアルゴリズムと数学 | ||
擬似乱数を生成します (関数) | ||
擬似乱数ジェネレータをシードします (関数) | ||
指定範囲の不特定な型の要素をソートします (関数) | ||
不特定な型の要素を指定の配列から探します (関数) | ||
(C++11) |
整数値の絶対値 (|x|) を計算します (関数) | |
(C++11) |
整数除算の商と余りを計算します (関数) |
[編集] 概要
namespace std { using size_t = /* see description */; using div_t = /* see description */; using ldiv_t = /* see description */; using lldiv_t = /* see description */; } #define NULL /* see description */ #define EXIT_FAILURE /* see description */ #define EXIT_SUCCESS /* see description */ #define RAND_MAX /* see description */ #define MB_CUR_MAX /* see description */ namespace std { // Exposition-only function type aliases extern "C" using /*c-atexit-handler*/ = void(); // exposition only extern "C++" using /*atexit-handler*/ = void(); // exposition only extern "C" using /*c-compare-pred*/ = int(const void*, const void*); // exposition only extern "C++" using /*compare-pred*/ = int(const void*, const void*); // exposition only // start and termination [[noreturn]] void abort() noexcept; int atexit(/*c-atexit-handler*/* func) noexcept; int atexit(/*atexit-handler*/* func) noexcept; int at_quick_exit(/*c-atexit-handler*/* func) noexcept; int at_quick_exit(/*atexit-handler*/* func) noexcept; [[noreturn]] void exit(int status); [[noreturn]] void _Exit(int status) noexcept; [[noreturn]] void quick_exit(int status) noexcept; char* getenv(const char* name); int system(const char* string); // C library memory allocation void* aligned_alloc(size_t alignment, size_t size); void* calloc(size_t nmemb, size_t size); void free(void* ptr); void* malloc(size_t size); void* realloc(void* ptr, size_t size); double atof(const char* nptr); int atoi(const char* nptr); long int atol(const char* nptr); long long int atoll(const char* nptr); double strtod(const char* nptr, char** endptr); float strtof(const char* nptr, char** endptr); long double strtold(const char* nptr, char** endptr); long int strtol(const char* nptr, char** endptr, int base); long long int strtoll(const char* nptr, char** endptr, int base); unsigned long int strtoul(const char* nptr, char** endptr, int base); unsigned long long int strtoull(const char* nptr, char** endptr, int base); // multibyte / wide string and character conversion functions int mblen(const char* s, size_t n); int mbtowc(wchar_t* pwc, const char* s, size_t n); int wctomb(char* s, wchar_t wchar); size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n); size_t wcstombs(char* s, const wchar_t* pwcs, size_t n); // C standard library algorithms void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, /*c-compare-pred*/* compar); 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); // low-quality random number generation int rand(); void srand(unsigned int seed); // absolute values int abs(int j); long int abs(long int j); long long int abs(long long int j); float abs(float j); double abs(double j); long double abs(long double j); long int labs(long int j); long long int llabs(long long int j); div_t div(int numer, int denom); ldiv_t div(long int numer, long int denom); lldiv_t div(long long int numer, long long int denom); ldiv_t ldiv(long int numer, long int denom); lldiv_t lldiv(long long int numer, long long int denom); }