dl
dl::Select 命名空间参考

容器选择操作 更多...

函数

template<typename C>
constexpr auto Max (const C &container)
 返回容器最大值
 
template<typename C>
constexpr auto Min (const C &container)
 返回容器最小值
 
template<typename C, typename F>
constexpr auto Max (const C &container, F func)
 返回容器最大值(计算结果)
 
template<typename C, typename F>
constexpr auto Min (const C &container, F func)
 返回容器最小值(计算结果)
 
template<typename C, typename F>
constexpr auto & MaxRef (C &container, F func)
 返回容器最大值
 
template<typename C, typename F>
constexpr auto & MinRef (C &container, F func)
 返回容器最小值
 
template<typename T>
TCreateIfEmpty (std::vector< T > &vec, std::size_t n)
 获取容器元素,如果小了,就扩容
 
template<typename T>
TCreateIfEmpty (std::vector< T > *vec, std::size_t n)
 获取容器元素,如果小了,就扩容
 
template<typename T>
TCreateIfEmpty (std::vector< std::vector< T > > &vec, std::size_t n0, std::size_t n1)
 获取容器元素,如果小了,就扩容
 

详细描述

容器选择操作

函数说明

◆ CreateIfEmpty() [1/3]

template<typename T>
T & dl::Select::CreateIfEmpty ( std::vector< std::vector< T > > & vec,
std::size_t n0,
std::size_t n1 )

获取容器元素,如果小了,就扩容

在文件 dl_range_select.h173 行定义.

◆ CreateIfEmpty() [2/3]

template<typename T>
T & dl::Select::CreateIfEmpty ( std::vector< T > & vec,
std::size_t n )

获取容器元素,如果小了,就扩容

注意
对引用取地址,并非原本引用对象的地址
resize可能导致重分配内存,但不会修改旧元素值

在文件 dl_range_select.h152 行定义.

◆ CreateIfEmpty() [3/3]

template<typename T>
T * dl::Select::CreateIfEmpty ( std::vector< T > * vec,
std::size_t n )

获取容器元素,如果小了,就扩容

在文件 dl_range_select.h163 行定义.

◆ Max() [1/2]

template<typename C>
auto dl::Select::Max ( const C & container)
constexpr

返回容器最大值

参数
[in]container操作的容器
返回值
为空时,返回类型的最小值

在文件 dl_range_select.h28 行定义.

◆ Max() [2/2]

template<typename C, typename F>
auto dl::Select::Max ( const C & container,
F func )
constexpr

返回容器最大值(计算结果)

参数
[in]container操作的容器
返回值
为空时,返回类型的最小值

在文件 dl_range_select.h64 行定义.

◆ MaxRef()

template<typename C, typename F>
auto & dl::Select::MaxRef ( C & container,
F func )
constexpr

返回容器最大值

参数
[in]container操作的容器,不能为空
返回值
返回对象的引用

在文件 dl_range_select.h102 行定义.

◆ Min() [1/2]

template<typename C>
auto dl::Select::Min ( const C & container)
constexpr

返回容器最小值

参数
[in]container操作的容器
返回值
为空时,返回类型的最大值

在文件 dl_range_select.h45 行定义.

◆ Min() [2/2]

template<typename C, typename F>
auto dl::Select::Min ( const C & container,
F func )
constexpr

返回容器最小值(计算结果)

参数
[in]container操作的容器
返回值
为空时,返回类型的最大值

在文件 dl_range_select.h82 行定义.

◆ MinRef()

template<typename C, typename F>
auto & dl::Select::MinRef ( C & container,
F func )
constexpr

返回容器最小值

参数
[in]container操作的容器,不能为空
返回值
返回对象的引用

在文件 dl_range_select.h126 行定义.