NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
元组

元组的主模板、特化实现和辅助函数 更多...

struct  tuple_size< array< T, Size > >
 数组的元组大小特化 更多...
struct  tuple_element< Idx, array< T, Size > >
 数组的元组元素类型特化 更多...
struct  tuple_size< typename >
 获取tuple大小的特化 更多...
struct  tuple_element< Index, Types >
 获取tuple元素类型的特化 更多...
struct  tuple_element< 0, tuple< This, Rest... > >
 获取tuple第一个元素类型的特化 更多...
struct  tuple_element< Index, tuple< This, Rest... > >
 递归获取tuple元素类型的特化 更多...
struct  tuple_size< pair< T1, T2 > >
 pair的tuple_size特化,固定为2 更多...
struct  tuple_element< Index, pair< T1, T2 > >
 pair的tuple_element特化 更多...
struct  tuple<>
 空元组特化 更多...
struct  tuple< This, Rest... >
 元组主模板 更多...

类型定义

template<size_t Index, typename... Types>
using tuple_element_t = typename tuple_element<Index, Types...>::type
 tuple_element的类型别名
template<size_t Index, typename... Types>
using tuple_extract_base_t = typename tuple_element<Index, Types...>::tuple_type
 获取tuple元素基类型的类型别名

函数

template<typename Func, typename Tuple>
constexpr decltype(auto) apply (Func &&f, Tuple &&t) noexcept(inner::__apply_unpack_tuple< _NEFORCE is_nothrow_invocable, Func, Tuple >::value)
 将元组元素解包作为参数调用函数
template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr tuple_element_t< Index, Types... > & get (tuple< Types... > &t)
 获取元组中指定位置的元素引用
template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr const tuple_element_t< Index, Types... > & get (const tuple< Types... > &t)
 获取元组中指定位置的元素常量引用
template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr tuple_element_t< Index, Types... > && get (tuple< Types... > &&t)
 获取元组中指定位置的元素右值引用
template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr const tuple_element_t< Index, Types... > && get (const tuple< Types... > &&t)
 获取元组中指定位置的元素常量右值引用
template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< unwrap_ref_decay_t< Types >... > make_tuple (Types &&... args)
 从参数创建元组
template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< Types &... > tie (Types &... args) noexcept
 创建引用元组
template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< Types &&... > forward_as_tuple (Types &&... args) noexcept
 创建转发引用元组
template<typename T, typename Tuple, enable_if_t< inner::constructible_from_tuple< T, Tuple >::value, int > = 0>
NEFORCE_NODISCARD constexpr T make_from_tuple (Tuple &&tup) noexcept(noexcept(inner::__broaden_make_from_tuple< T >(_NEFORCE forward< Tuple >(tup), make_index_sequence< tuple_size< remove_reference_t< Tuple > >::value >{})))
 从元组构造对象
template<typename... Tuples>
NEFORCE_NODISCARD constexpr inner::tuple_cat_bind_t< Tuples... >::Ret tuple_cat (Tuples &&... tuples)
 连接多个元组

变量

template<typename T, size_t Size>
NEFORCE_INLINE17 constexpr size_t tuple_size_v< array< T, Size > > = Size
 元组大小值
template<typename T, size_t Size>
NEFORCE_INLINE17 constexpr size_t tuple_size_v< const array< T, Size > > = Size
 常量数组的元组大小值
template<typename T>
constexpr size_t tuple_size_v = tuple_size<remove_cvref_t<T>>::value
 tuple_size的类型别名

详细描述

元组的主模板、特化实现和辅助函数

类型定义说明

◆ tuple_element_t

template<size_t Index, typename... Types>
using tuple_element_t = typename tuple_element<Index, Types...>::type

tuple_element的类型别名

模板参数
Index元素索引
Typestuple的元素类型

tuple_element的类型别名,便于获取tuple元素类型

在文件 pair.hpp52 行定义.

◆ tuple_extract_base_t

template<size_t Index, typename... Types>
using tuple_extract_base_t = typename tuple_element<Index, Types...>::tuple_type

获取tuple元素基类型的类型别名

模板参数
Index元素索引
Typestuple的元素类型

在文件 pair.hpp60 行定义.

函数说明

◆ apply()

template<typename Func, typename Tuple>
decltype(auto) apply ( Func && f,
Tuple && t )
constexprnoexcept

将元组元素解包作为参数调用函数

模板参数
Func可调用对象类型
Tuple元组类型
参数
f可调用对象
t元组
返回
函数调用结果

将元组中的元素解包,作为参数调用函数。 支持完美转发,可以处理元组的不同引用和常量限定。

在文件 apply.hpp63 行定义.

引用了 forward().

被这些函数引用 signal< Types >::emit_executor(), get_current_task_group(), lazy_thread::lazy_thread(), thread::start() , 以及 thread::thread().

◆ forward_as_tuple()

template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< Types &&... > forward_as_tuple ( Types &&... args)
constexprnoexcept

创建转发引用元组

模板参数
Types转发引用类型
参数
args转发引用参数
返回
创建的转发引用元组

在文件 tuple.hpp781 行定义.

引用了 forward().

被这些函数引用 binder< Func(BoundArgs...)>::operator()(), binder< Func(BoundArgs...)>::operator()(), bindrer< Res, Func(BoundArgs...)>::operator()(), bindrer< Res, Func(BoundArgs...)>::operator()() , 以及 tuple_cat().

◆ get() [1/4]

template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr const tuple_element_t< Index, Types... > && get ( const tuple< Types... > && t)
constexprnoexcept

获取元组中指定位置的元素常量右值引用

模板参数
Index元素索引
Types元组元素类型
参数
t元组
返回
指定位置元素的常量右值引用

在文件 tuple.hpp719 行定义.

◆ get() [2/4]

template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr const tuple_element_t< Index, Types... > & get ( const tuple< Types... > & t)
constexprnoexcept

获取元组中指定位置的元素常量引用

模板参数
Index元素索引
Types元组元素类型
参数
t元组
返回
指定位置元素的常量引用

在文件 tuple.hpp691 行定义.

◆ get() [3/4]

template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr tuple_element_t< Index, Types... > && get ( tuple< Types... > && t)
constexprnoexcept

获取元组中指定位置的元素右值引用

模板参数
Index元素索引
Types元组元素类型
参数
t元组
返回
指定位置元素的右值引用

在文件 tuple.hpp705 行定义.

◆ get() [4/4]

template<size_t Index, typename... Types>
NEFORCE_NODISCARD constexpr tuple_element_t< Index, Types... > & get ( tuple< Types... > & t)
constexprnoexcept

获取元组中指定位置的元素引用

模板参数
Index元素索引
Types元组元素类型
参数
t元组
返回
指定位置元素的引用

在文件 tuple.hpp677 行定义.

◆ make_from_tuple()

template<typename T, typename Tuple, enable_if_t< inner::constructible_from_tuple< T, Tuple >::value, int > = 0>
NEFORCE_NODISCARD constexpr T make_from_tuple ( Tuple && tup)
constexprnoexcept

从元组构造对象

模板参数
T目标类型
Tuple源元组类型
参数
tup源元组
返回
构造的对象

在文件 tuple.hpp823 行定义.

引用了 forward().

◆ make_tuple()

template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< unwrap_ref_decay_t< Types >... > make_tuple ( Types &&... args)
constexpr

从参数创建元组

模板参数
Types参数类型
参数
args参数
返回
创建的元组

在文件 tuple.hpp757 行定义.

引用了 forward().

被这些函数引用 signal< Types >::emit_executor(), get_current_task_group(), lazy_thread::lazy_thread(), thread::start(), thread::thread() , 以及 thread_pool::wait().

◆ tie()

template<typename... Types>
NEFORCE_NODISCARD constexpr tuple< Types &... > tie ( Types &... args)
constexprnoexcept

创建引用元组

模板参数
Types引用类型
参数
args引用参数
返回
创建的引用元组

在文件 tuple.hpp769 行定义.

◆ tuple_cat()

template<typename... Tuples>
NEFORCE_NODISCARD constexpr inner::tuple_cat_bind_t< Tuples... >::Ret tuple_cat ( Tuples &&... tuples)
constexpr

连接多个元组

模板参数
Tuples要连接的元组类型
参数
tuples要连接的元组
返回
连接后的元组

在文件 tuple.hpp881 行定义.

引用了 forward() , 以及 forward_as_tuple().

变量说明

◆ tuple_size_v

template<typename T>
size_t tuple_size_v = tuple_size<remove_cvref_t<T>>::value
constexpr

tuple_size的类型别名

模板参数
Ttuple类型

tuple_size的类型别名,便于获取tuple大小

在文件 pair.hpp37 行定义.