NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
narrow_char_traits< CharT, IntT > 模板结构体 参考

窄字符特征模板 更多...

#include <char_traits.hpp>

类 narrow_char_traits< CharT, IntT > 继承关系图:
[图例]

Public 类型

using char_type = CharT
 字符类型
using int_type = IntT
 整数类型

静态 Public 成员函数

static NEFORCE_NODISCARD constexpr int compare (const char_type *lhs, const char_type *rhs, const size_t n) noexcept
 比较两个字符序列(内存优化版本)
static NEFORCE_NODISCARD constexpr const char_typefind (const char_type *str, const size_t n, const char_type chr) noexcept
 在字符序列中查找指定字符(内存优化版本)
static constexpr char_typeassign (char_type *str, size_t n, const char_type chr) noexcept
 将字符序列中的每个字符设置为指定值(内存优化版本)
static constexpr void assign (char_type &lhs, const char_type &rhs) noexcept
 赋值单个字符
static constexpr char_typecopy (char_type *dest, const char_type *srcs, const size_t count) noexcept
 复制字符序列
static NEFORCE_NODISCARD constexpr int_type eof () noexcept
 返回EOF值
static NEFORCE_NODISCARD constexpr bool eq (const char_type lhs, const char_type rhs) noexcept
 相等比较
static NEFORCE_NODISCARD constexpr size_t length (const char_type *str) noexcept
 计算字符串长度
static NEFORCE_NODISCARD constexpr bool lt (const char_type lhs, const char_type rhs) noexcept
 小于比较
static constexpr char_typemove (char_type *dest, const char_type *srcs, const size_t count) noexcept
 移动字符序列
static NEFORCE_NODISCARD constexpr int_type not_eof (const int_type rsc) noexcept
 如果不是EOF则返回原值,否则返回0

详细描述

template<typename CharT, typename IntT>
struct narrow_char_traits< CharT, IntT >

窄字符特征模板

模板参数
CharT字符类型
IntT整数类型

为窄字符类型提供优化的内存操作实现。

在文件 char_traits.hpp154 行定义.

成员函数说明

◆ assign() [1/2]

template<typename CharT, typename IntT>
constexpr void narrow_char_traits< CharT, IntT >::assign ( char_type & lhs,
const char_type & rhs )
inlinestaticconstexprnoexcept

赋值单个字符

参数
lhs左值引用
rhs右值引用

在文件 char_traits.hpp213 行定义.

◆ assign() [2/2]

template<typename CharT, typename IntT>
constexpr char_type * narrow_char_traits< CharT, IntT >::assign ( char_type * str,
size_t n,
const char_type chr )
inlinestaticconstexprnoexcept

将字符序列中的每个字符设置为指定值(内存优化版本)

参数
str目标字符序列
n序列长度
chr要设置的字符
返回
str指针

在文件 char_traits.hpp204 行定义.

引用了 memory_set().

◆ compare()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr int narrow_char_traits< CharT, IntT >::compare ( const char_type * lhs,
const char_type * rhs,
const size_t n )
inlinestaticconstexprnoexcept

比较两个字符序列(内存优化版本)

参数
lhs左序列
rhs右序列
n要比较的字符数
返回
比较结果

在文件 char_traits.hpp180 行定义.

引用了 memory_compare().

◆ copy()

template<typename CharT, typename IntT>
constexpr char_type * base_char_traits< CharT, IntT >::copy ( char_type * dest,
const char_type * srcs,
const size_t count )
inlinestaticconstexprnoexcept

复制字符序列

参数
dest目标地址
srcs源地址
count要复制的字符数
返回
dest指针

在文件 char_traits.hpp46 行定义.

◆ eof()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr int_type base_char_traits< CharT, IntT >::eof ( )
inlinestaticconstexprnoexcept

返回EOF值

返回
EOF值

在文件 char_traits.hpp142 行定义.

◆ eq()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr bool base_char_traits< CharT, IntT >::eq ( const char_type lhs,
const char_type rhs )
inlinestaticconstexprnoexcept

相等比较

参数
lhs左字符
rhs右字符
返回
是否相等

在文件 char_traits.hpp119 行定义.

◆ find()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr const char_type * narrow_char_traits< CharT, IntT >::find ( const char_type * str,
const size_t n,
const char_type chr )
inlinestaticconstexprnoexcept

在字符序列中查找指定字符(内存优化版本)

参数
str字符序列
n序列长度
chr要查找的字符
返回
指向第一个匹配字符的指针

在文件 char_traits.hpp192 行定义.

引用了 memory_find().

◆ length()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr size_t base_char_traits< CharT, IntT >::length ( const char_type * str)
inlinestaticconstexprnoexcept

计算字符串长度

参数
str以空字符结尾的字符串
返回
字符串长度(不含空字符)

在文件 char_traits.hpp79 行定义.

◆ lt()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr bool base_char_traits< CharT, IntT >::lt ( const char_type lhs,
const char_type rhs )
inlinestaticconstexprnoexcept

小于比较

参数
lhs左字符
rhs右字符
返回
是否lhs < rhs

在文件 char_traits.hpp127 行定义.

◆ move()

template<typename CharT, typename IntT>
constexpr char_type * base_char_traits< CharT, IntT >::move ( char_type * dest,
const char_type * srcs,
const size_t count )
inlinestaticconstexprnoexcept

移动字符序列

参数
dest目标地址
srcs源地址
count要移动的字符数
返回
dest指针

在文件 char_traits.hpp58 行定义.

◆ not_eof()

template<typename CharT, typename IntT>
NEFORCE_NODISCARD constexpr int_type base_char_traits< CharT, IntT >::not_eof ( const int_type rsc)
inlinestaticconstexprnoexcept

如果不是EOF则返回原值,否则返回0

参数
rsc输入值
返回
非EOF值或0

在文件 char_traits.hpp134 行定义.


该结构体的文档由以下文件生成: