|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
字符串与数据类型之间的转换功能 更多...
函数 | |
| template<typename T, enable_if_t< is_base_of_v< istringify< T >, T >, int > = 0> | |
| constexpr string | to_string (const T &obj) |
| 将实现了istringify接口的对象转换为字符串 | |
| constexpr uint128_t | to_uint128 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为128位无符号整数 | |
| constexpr int128_t | to_int128 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为128位有符号整数 | |
| constexpr float32_t | to_float32 (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为32位浮点数 | |
| constexpr float64_t | to_float64 (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为64位浮点数 | |
| constexpr decimal_t | to_decimal (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为decimal浮点数 | |
| constexpr int64_t | to_int64 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为64位有符号整数 | |
| constexpr uint64_t | to_uint64 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为64位无符号整数 | |
| constexpr int32_t | to_int32 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为32位有符号整数 | |
| constexpr uint32_t | to_uint32 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为32位无符号整数 | |
| constexpr int16_t | to_int16 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为16位有符号整数 | |
| constexpr uint16_t | to_uint16 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为16位无符号整数 | |
| constexpr int8_t | to_int8 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为8位有符号整数 | |
| constexpr uint8_t | to_uint8 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为8位无符号整数 | |
| template<typename T, typename P = package_t<T>, enable_if_t< is_packaged_v< T > &&is_base_of_v< istringify< P >, P >, int > = 0> | |
| constexpr string | to_string (const T &value) |
| 将可包装类型转换为字符串 | |
| constexpr string | to_string (nullptr_t np) |
| 将空指针转换为字符串 | |
| template<typename IfEmpty, typename T> | |
| constexpr string | to_string (const compressed_pair< IfEmpty, T, true > &obj) |
| 将压缩对(已压缩版本)转换为字符串 | |
| template<typename IfEmpty, typename T> | |
| constexpr string | to_string (const compressed_pair< IfEmpty, T, false > &obj) |
| 将压缩对(未压缩版本)转换为字符串 | |
| template<typename T1, typename T2> | |
| constexpr string | to_string (const pair< T1, T2 > &obj) |
| 将对转换为字符串 | |
| template<typename... Args> | |
| constexpr string | to_string (const tuple< Args... > &tup) |
| 将元组转换为字符串 | |
| template<typename... Args, enable_if_t<(sizeof...(Args) > 1), int > = 0> | |
| constexpr string | to_string (Args &&... args) |
| 将多个参数转换为字符串并连接 | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | to_string_with_precision (T x, int precision, bool scientific=false) |
| 将浮点数转换为字符串(带精度控制) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | to_string_general (T x, int precision=6) |
| 将浮点数转换为字符串(通用格式) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | to_string_fixed (T x, int precision=6) |
| 将浮点数转换为字符串(固定小数格式) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | to_string_scientific (T x, int precision=6) |
| 将浮点数转换为字符串(科学计数法格式) | |
字符串与数据类型之间的转换功能
|
nodiscardconstexpr |
将字符串转换为decimal浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 545 行定义.
|
nodiscardconstexpr |
将字符串转换为32位浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 507 行定义.
|
nodiscardconstexpr |
将字符串转换为64位浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 526 行定义.
|
nodiscardconstexpr |
将字符串转换为128位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 int128.hpp 第 813 行定义.
引用了 basic_string_view< CharT, Traits >::data().
被这些函数引用 int128_t::int128_t().
|
nodiscardconstexpr |
将字符串转换为16位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 645 行定义.
引用了 numeric_traits< T, Dummy >::max(), numeric_traits< T, Dummy >::min() , 以及 to_int32().
|
nodiscardconstexpr |
将字符串转换为32位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 605 行定义.
引用了 basic_string_view< CharT, Traits >::data().
被这些函数引用 boolean::parse(), to_int16() , 以及 to_int8().
|
nodiscardconstexpr |
将字符串转换为64位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 565 行定义.
|
nodiscardconstexpr |
将字符串转换为8位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 678 行定义.
引用了 numeric_traits< T, Dummy >::max(), numeric_traits< T, Dummy >::min() , 以及 to_int32().
|
nodiscardconstexpr |
将多个参数转换为字符串并连接
| Args | 参数类型 |
| args | 参数 |
在文件 to_string.hpp 第 241 行定义.
引用了 forward() , 以及 to_string().
|
nodiscardconstexpr |
将压缩对(未压缩版本)转换为字符串
| IfEmpty | 空基类类型 |
| T | 值类型 |
| obj | 压缩对 |
在文件 to_string.hpp 第 159 行定义.
引用了 to_string() , 以及 compressed_pair< IfEmpty, T, Compressed >::value.
|
nodiscardconstexpr |
将压缩对(已压缩版本)转换为字符串
| IfEmpty | 空基类类型 |
| T | 值类型 |
| obj | 压缩对 |
在文件 to_string.hpp 第 147 行定义.
引用了 to_string() , 以及 compressed_pair< IfEmpty, T, Compressed >::value.
|
nodiscardconstexpr |
将对转换为字符串
| T1 | 第一个类型 |
| T2 | 第二个类型 |
| obj | 对 |
在文件 to_string.hpp 第 171 行定义.
引用了 pair< T1, T2 >::first, pair< T1, T2 >::second , 以及 to_string().
|
nodiscardconstexpr |
将实现了istringify接口的对象转换为字符串
| T | 对象类型 |
| obj | 要转换的对象 |
全局辅助函数,用于方便地调用实现了istringify接口的对象的to_string方法。 仅当T是istringify<T>的派生类时可用。
在文件 istringify.hpp 第 68 行定义.
|
nodiscardconstexpr |
将可包装类型转换为字符串
| T | 可包装类型 |
| value | 要转换的值 |
通过包装类型进行字符串转换,要求包装类型实现了istringify接口。
在文件 to_string.hpp 第 36 行定义.
引用了 to_string().
被这些函数引用 to_string(), to_string(), to_string(), to_string() , 以及 to_string().
|
nodiscardconstexpr |
|
nodiscardconstexpr |
将浮点数转换为字符串(固定小数格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 533 行定义.
被这些函数引用 formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()().
|
nodiscardconstexpr |
将浮点数转换为字符串(通用格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 521 行定义.
被这些函数引用 formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()().
|
nodiscardconstexpr |
将浮点数转换为字符串(科学计数法格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 545 行定义.
被这些函数引用 formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()().
|
nodiscardconstexpr |
将浮点数转换为字符串(带精度控制)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
| scientific | 是否使用科学计数法 |
在文件 to_string.hpp 第 509 行定义.
|
nodiscardconstexpr |
将字符串转换为128位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 int128.hpp 第 793 行定义.
引用了 basic_string_view< CharT, Traits >::data().
被这些函数引用 int128_t::operator<<=() , 以及 uint128_t::uint128_t().
|
nodiscardconstexpr |
将字符串转换为16位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 662 行定义.
引用了 numeric_traits< T, Dummy >::max() , 以及 to_uint32().
|
nodiscardconstexpr |
将字符串转换为32位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 625 行定义.
引用了 basic_string_view< CharT, Traits >::data().
被这些函数引用 to_uint16() , 以及 to_uint8().
|
nodiscardconstexpr |
将字符串转换为64位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 585 行定义.
|
nodiscardconstexpr |
将字符串转换为8位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 695 行定义.
引用了 numeric_traits< T, Dummy >::max() , 以及 to_uint32().