cppreference.cn
创建账户
登录
命名空间
页面
讨论
变体
视图
查看
编辑
历史
操作
std::error_code::
assign
来自 cppreference.cn
<
cpp
|
error
|
error code
C++
编译器支持
独立和宿主
语言
标准库
标准库头文件
具名要求
特性测试宏
(C++20)
语言支持库
概念库
(C++20)
诊断库
内存管理库
元编程库
(C++11)
通用工具库
容器库
迭代器库
范围库
(C++20)
算法库
字符串库
文本处理库
数值库
日期和时间库
输入/输出库
文件系统库
(C++17)
并发支持库
(C++11)
执行控制库
(C++26)
技术规范
符号索引
外部库
[编辑]
工具库
语言支持
类型支持
(基本类型,RTTI)
库特性测试宏
(C++20)
程序工具
可变参数函数
initializer_list
(C++11)
is_constant_evaluated
(C++20)
is_within_lifetime
(C++26)
source_location
(C++20)
协程支持
(C++20)
契约支持
(C++26)
三路比较
three_way_comparable
three_way_comparable_with
(C++20)
(C++20)
strong_ordering
(C++20)
weak_ordering
(C++20)
partial_ordering
(C++20)
common_comparison_category
(C++20)
compare_three_way_result
(C++20)
compare_three_way
(C++20)
strong_order
(C++20)
weak_order
(C++20)
partial_order
(C++20)
compare_strong_order_fallback
(C++20)
compare_weak_order_fallback
(C++20)
compare_partial_order_fallback
(C++20)
is_eq
is_lt
is_lteq
(C++20)
(C++20)
(C++20)
is_neq
is_gt
is_gteq
(C++20)
(C++20)
(C++20)
通用工具
函数对象
位操作
(C++20)
bitset
hash
(C++11)
关系运算符
(在 C++20 中弃用)
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
整数比较函数
cmp_equal
cmp_less
cmp_less_than
(C++20)
(C++20)
(C++20)
cmp_not_equal
cmp_greater
cmp_greater_than
(C++20)
(C++20)
(C++20)
in_range
(C++20)
交换
和
类型操作
swap
ranges::swap
(C++20)
exchange
(C++14)
declval
(C++11)
to_underlying
(C++23)
forward
(C++11)
forward_like
(C++23)
move
(C++11)
move_if_noexcept
(C++11)
as_const
(C++17)
常用词汇类型
pair
tuple
(C++11)
optional
(C++17)
any
(C++17)
variant
(C++17)
tuple_size
(C++11)
tuple_element
(C++11)
apply
(C++17)
make_from_tuple
(C++17)
expected
(C++23)
[编辑]
诊断库
异常处理
exception
uncaught_exception
uncaught_exceptions
(
直到 C++20*
)
(C++17)
exception_ptr
(C++11)
make_exception_ptr
(C++11)
current_exception
(C++11)
rethrow_exception
(C++11)
nested_exception
(C++11)
throw_with_nested
(C++11)
rethrow_if_nested
(C++11)
异常处理失败
terminate
terminate_handler
get_terminate
(C++11)
set_terminate
bad_exception
unexpected
(
直到 C++17*
)
unexpected_handler
(
直到 C++17*
)
get_unexpected
(
直到 C++17*
)
set_unexpected
(
直到 C++17*
)
错误编号
错误码
errno
断言
assert
异常类别
logic_error
invalid_argument
domain_error
length_error
out_of_range
runtime_error
range_error
overflow_error
underflow_error
tx_exception
(TM TS)
系统错误
error_category
(C++11)
generic_category
(C++11)
system_category
(C++11)
error_condition
(C++11)
errc
(C++11)
error_code
(C++11)
system_error
(C++11)
堆栈回溯
stacktrace_entry
(C++23)
basic_stacktrace
(C++23)
调试支持
is_debugger_present
(C++26)
breakpoint_if_debugging
(C++26)
breakpoint
(C++26)
[编辑]
std::error_code
成员函数
error_code::error_code
error_code::operator=
error_code::assign
修改器
error_code::clear
观察器
error_code::value
error_code::category
error_code::default_error_condition
error_code::message
error_code::operator bool
非成员函数
operator==
operator!=
operator<
operator<=>
(直到 C++20)
(直到 C++20)
(C++20)
operator<<
辅助类
is_error_code_enum
hash
<std::error_code>
[编辑]
void
assign
(
int
val,
const
error_category
&
cat
)
noexcept
;
(自 C++11 起)
用错误码值
val
和对应的类别
cat
替换内容。
[
编辑
]
参数
val
-
要赋值的平台相关的错误码值
cat
-
对应于
val
的错误类别
[
编辑
]
返回值
(无)
[
编辑
]
参见
operator=
赋值另一个错误码
(公共成员函数)
[编辑]