RMVL  1.5.0-dev
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
rm::RaHeap< Tp, Sequence, Compare > 模板类 参考

支持随机访问的堆(与 std::priority_queue 具备相同的基础容器筛选条件) 更多...

#include <rmvl/core/datastruct.hpp>

rm::RaHeap< Tp, Sequence, Compare > 的协作图:

Public 类型

typedef Tp value_type
 
typedef Tp & reference
 
typedef const Tp & const_reference
 
typedef std::size_t size_type
 
typedef Sequence container_type
 
typedef Compare value_compare
 

Public 成员函数

 RaHeap ()=default
 
void push (const Tp &x)
 在堆顶添加元素
 
void push (Tp &&x)
 在堆顶添加元素
 
template<typename ValueType >
void emplace (ValueType &&x)
 在堆顶添加元素
 
void update (const Tp &prev, const Tp &value)
 更新元素
 
void erase (const Tp &value)
 删除指定元素
 
void pop ()
 弹出堆顶
 
bool empty ()
 堆是否为空
 
std::size_t size ()
 堆的大小
 
const Tp & top () const
 获取堆顶元素
 
const Sequence & extract () const
 导出容器
 

详细描述

template<typename Tp, typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
class rm::RaHeap< Tp, Sequence, Compare >

支持随机访问的堆(与 std::priority_queue 具备相同的基础容器筛选条件)

模板参数
Tp元素类型
Sequence容器类型,默认为 std::vector<Tp>
Compare比较器可调用对象,默认为 std::less<Tp>,即默认为大根堆

成员类型定义说明

◆ const_reference

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
const Tp& rm::RaHeap< Tp, Sequence, Compare >::const_reference

◆ container_type

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
Sequence rm::RaHeap< Tp, Sequence, Compare >::container_type

◆ reference

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
Tp& rm::RaHeap< Tp, Sequence, Compare >::reference

◆ size_type

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
std::size_t rm::RaHeap< Tp, Sequence, Compare >::size_type

◆ value_compare

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
Compare rm::RaHeap< Tp, Sequence, Compare >::value_compare

◆ value_type

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
Tp rm::RaHeap< Tp, Sequence, Compare >::value_type

构造及析构函数说明

◆ RaHeap()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
rm::RaHeap< Tp, Sequence, Compare >::RaHeap ( )
default

成员函数说明

◆ emplace()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
template<typename ValueType >
void rm::RaHeap< Tp, Sequence, Compare >::emplace ( ValueType && x)
inline

在堆顶添加元素

参数
[in]x待添加的元素

◆ empty()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
bool rm::RaHeap< Tp, Sequence, Compare >::empty ( )
inline

堆是否为空

◆ erase()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
void rm::RaHeap< Tp, Sequence, Compare >::erase ( const Tp & value)
inline

删除指定元素

参数
[in]value待删除的元素

◆ extract()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
const Sequence & rm::RaHeap< Tp, Sequence, Compare >::extract ( ) const
inline

导出容器

◆ pop()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
void rm::RaHeap< Tp, Sequence, Compare >::pop ( )
inline

弹出堆顶

◆ push() [1/2]

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
void rm::RaHeap< Tp, Sequence, Compare >::push ( const Tp & x)
inline

在堆顶添加元素

参数
[in]x待添加的元素

◆ push() [2/2]

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
void rm::RaHeap< Tp, Sequence, Compare >::push ( Tp && x)
inline

在堆顶添加元素

参数
[in]x待添加的元素

◆ size()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
std::size_t rm::RaHeap< Tp, Sequence, Compare >::size ( )
inline

堆的大小

◆ top()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
const Tp & rm::RaHeap< Tp, Sequence, Compare >::top ( ) const
inline

获取堆顶元素

◆ update()

template<typename Tp , typename Sequence = std::vector<Tp>, typename Compare = std::less<Tp>>
void rm::RaHeap< Tp, Sequence, Compare >::update ( const Tp & prev,
const Tp & value )
inline

更新元素

参数
[in]prev之前的元素
[in]value改动后的元素

该类的文档由以下文件生成: