C++
语言
标准库头文件
自立与有宿主实现
具名要求
语言支持库
概念库 (C++20)
诊断库
工具库
字符串库
容器库
迭代器库
范围库 (C++20)
算法库
数值库
本地化库
输入/输出库
文件系统库 (C++17)
正则表达式库 (C++11)
原子操作库 (C++11)
线程支持库 (C++11)
技术规范
工具库
语言支持
类型支持(基本类型、 RTTI 、类型特征)
库功能特性测试宏 (C++20)
动态内存管理
程序工具
错误处理
协程支持 (C++20)
变参数函数
launder(C++17)
initializer_list(C++11)
source_location(C++20)
三路比较 (C++20)
three_way_comparablethree_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_eqis_neqis_ltis_lteqis_gtis_gteq(C++20)(C++20)(C++20)(C++20)(C++20)(C++20)
通用工具
日期和时间
函数对象
格式化库 (C++20)
bitset
hash(C++11)
integer_sequence(C++14)
关系运算符 (C++20 中弃用)
rel_ops::operator!=rel_ops::operator>rel_ops::operator=
整数比较函数
cmp_equalcmp_not_equalcmp_lesscmp_greatercmp_less_thancmp_greater_than(C++20)(C++20)(C++20)(C++20)(C++20)(C++20)
in_range(C++20)
swap 与类型运算
swap
ranges::swap(C++20)
exchange(C++14)
declval(C++11)
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
as_const(C++17)
常用词汇类型
pair
tuple(C++11)
apply(C++17)
make_from_tuple(C++17)
optional(C++17)
any(C++17)
variant(C++17)
初等字符串转换
to_chars(C++17)
from_chars(C++17)
chars_format(C++17)
类型支持
基本类型
基础类型
定宽整数类型 (C++11)
ptrdiff_t
size_t
max_align_t(C++11)
byte(C++17)
nullptr_t(C++11)
offsetof
NULL
数值极限
numeric_limits
C 数值极限接口
运行时类型信息
type_info
type_index(C++11)
bad_typeid
bad_cast
类型特性
类型类别
is_void(C++11)
is_null_pointer(C++14)
is_array(C++11)
is_pointer(C++11)
is_enum(C++11)
is_union(C++11)
is_class(C++11)
is_function(C++11)
is_object(C++11)
is_scalar(C++11)
is_compound(C++11)
is_integral(C++11)
is_floating_point(C++11)
is_fundamental(C++11)
is_arithmetic(C++11)
is_reference(C++11)
is_lvalue_reference(C++11)
is_rvalue_reference(C++11)
is_member_pointer(C++11)
is_member_object_pointer(C++11)
is_member_function_pointer(C++11)
类型属性
is_const(C++11)
is_volatile(C++11)
is_empty(C++11)
is_polymorphic(C++11)
is_final(C++14)
is_abstract(C++11)
is_aggregate(C++17)
is_trivial(C++11)
is_trivially_copyable(C++11)
is_standard_layout(C++11)
is_literal_type(C++11)(C++20 前)
is_pod(C++11)(C++20 中弃用)
is_signed(C++11)
is_unsigned(C++11)
is_bounded_array(C++20)
is_unbounded_array(C++20)
has_unique_object_representations(C++17)
类型特性常量
integral_constantbool_constanttrue_typefalse_type(C++11)(C++17)(C++11)(C++11)
元函数
conjunction(C++17)
disjunction(C++17)
negation(C++17)
常量求值语境
is_constant_evaluated(C++20)
受支持操作
is_constructibleis_trivially_constructibleis_nothrow_constructible(C++11)(C++11)(C++11)
is_default_constructibleis_trivially_default_constructibleis_nothrow_default_constructible(C++11)(C++11)(C++11)
is_copy_constructibleis_trivially_copy_constructibleis_nothrow_copy_constructible(C++11)(C++11)(C++11)
is_move_constructibleis_trivially_move_constructibleis_nothrow_move_constructible(C++11)(C++11)(C++11)
is_assignableis_trivially_assignableis_nothrow_assignable(C++11)(C++11)(C++11)
is_copy_assignableis_trivially_copy_assignableis_nothrow_copy_assignable(C++11)(C++11)(C++11)
is_move_assignableis_trivially_move_assignableis_nothrow_move_assignable(C++11)(C++11)(C++11)
is_destructibleis_trivially_destructibleis_nothrow_destructible(C++11)(C++11)(C++11)
has_virtual_destructor(C++11)
is_swappable_withis_swappableis_nothrow_swappable_withis_nothrow_swappable(C++17)(C++17)(C++17)(C++17)
关系与属性查询
is_same(C++11)
is_base_of(C++11)
is_convertibleis_nothrow_convertible(C++11)(C++20)
is_layout_compatible(C++20)
is_pointer_interconvertible_base_of(C++20)
is_pointer_interconvertible_with_class(C++20)
is_corresponding_member(C++20)
alignment_of(C++11)
rank(C++11)
extent(C++11)
is_invocableis_invocable_ris_nothrow_invocableis_nothrow_invocable_r(C++17)(C++17)(C++17)(C++17)
类型修改
remove_cvremove_constremove_volatile(C++11)(C++11)(C++11)
add_cvadd_constadd_volatile(C++11)(C++11)(C++11)
make_signed(C++11)
make_unsigned(C++11)
remove_reference(C++11)
add_lvalue_referenceadd_rvalue_reference(C++11)(C++11)
remove_pointer(C++11)
add_pointer(C++11)
remove_extent(C++11)
remove_all_extents(C++11)
类型变换
aligned_storage(C++11)
aligned_union(C++11)
decay(C++11)
remove_cvref(C++20)
enable_if(C++11)
void_t(C++17)
conditional(C++11)
common_type(C++11)
common_reference(C++20)
underlying_type(C++11)
result_ofinvoke_result(C++11)(C++20 前)(C++17)
type_identity(C++20)
定义于头文件
template
struct remove_reference;
(C++11 起)
若类型 T 为引用类型,则提供成员 typedef type ,其为 T 所引用的类型。否则 type 为 T 。
添加 remove_reference 的特化的程序行为未定义。
成员类型
名称
定义
type
T 所引用的类型,或若 T 不是引用则为 T
辅助类型
template
using remove_reference_t = typename remove_reference::type;
(C++14 起)
可能的实现
template struct remove_reference {typedef T type;};
template struct remove_reference {typedef T type;};
template struct remove_reference {typedef T type;};
示例
运行此代码
#include // std::cout
#include // std::is_same
template
void print_is_same() {
std::cout |