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

位图容器 更多...

#include <bitmap.hpp>

类 bitmap 继承关系图:
[图例]

Public 类型

using value_type = bool
 值类型
using pointer = bit_reference*
 指针类型
using reference = bit_reference
 引用类型
using const_pointer = const bool*
 常量指针类型
using const_reference = const bool
 常量引用类型
using size_type = size_t
 大小类型
using difference_type = ptrdiff_t
 差值类型
using iterator = bitmap_iterator<false, bitmap>
 迭代器类型
using const_iterator = bitmap_iterator<true, bitmap>
 常量迭代器类型
using reverse_iterator = _NEFORCE reverse_iterator<iterator>
 反向迭代器类型
using const_reverse_iterator = _NEFORCE reverse_iterator<const_iterator>
 常量反向迭代器类型
using allocator_type = allocator<uint32_t>
 分配器类型

Public 成员函数

constexpr bitmap () noexcept=default
 默认构造函数
constexpr bitmap (const size_type word)
 构造函数,指定大小
constexpr bitmap (const size_type word, const bool value)
 构造函数,指定大小和初始值
constexpr bitmap (const int32_t word, const bool value)
 32位整数构造函数
constexpr bitmap (const int64_t word, const bool value)
 64位整数构造函数
constexpr bitmap (const bitmap &other)
 拷贝构造函数
constexpr bitmapoperator= (const bitmap &other)
 拷贝赋值运算符
constexpr bitmap (bitmap &&other) noexcept
 移动构造函数
constexpr bitmapoperator= (bitmap &&other) noexcept
 移动赋值运算符
template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
constexpr bitmap (Iterator first, Iterator last)
 范围构造函数
constexpr ~bitmap ()=default
 析构函数
constexpr iterator begin () noexcept
 获取起始迭代器
constexpr iterator end () noexcept
 获取结束迭代器
constexpr const_iterator begin () const noexcept
 获取常量起始迭代器
constexpr const_iterator end () const noexcept
 获取常量结束迭代器
constexpr const_iterator cbegin () const noexcept
 获取常量起始迭代器
constexpr const_iterator cend () const noexcept
 获取常量结束迭代器
constexpr reverse_iterator rbegin () noexcept
 获取反向起始迭代器
constexpr reverse_iterator rend () noexcept
 获取反向结束迭代器
constexpr const_reverse_iterator rbegin () const noexcept
 获取常量反向起始迭代器
constexpr const_reverse_iterator rend () const noexcept
 获取常量反向结束迭代器
constexpr const_reverse_iterator crbegin () const noexcept
 获取常量反向起始迭代器
constexpr const_reverse_iterator crend () const noexcept
 获取常量反向结束迭代器
constexpr size_type size () const noexcept
 获取位数
constexpr size_type max_size () const noexcept
 获取最大可能位数
constexpr bool empty () const noexcept
 检查是否为空
constexpr size_type capacity () const noexcept
 获取容量(位数)
constexpr reference operator[] (const size_type n)
 下标访问操作符
constexpr const_reference operator[] (const size_type n) const
 常量下标访问操作符
constexpr reference front ()
 访问第一个位
constexpr const_reference front () const
 常量版本,访问第一个位
constexpr reference back ()
 访问最后一个位
constexpr const_reference back () const
 常量版本,访问最后一个位
constexpr void reserve (const size_type n)
 预留容量
constexpr void push_back (const bool value)
 在末尾插入位
constexpr iterator insert (const iterator &position, const bool value)
 在指定位置插入位
template<typename Iterator>
constexpr void insert (iterator position, Iterator first, Iterator last)
 范围插入
constexpr void insert (const iterator &position, const bool *first, const bool *last)
 插入布尔数组范围
constexpr void insert (const iterator &position, const size_type n, const bool value)
 插入n个相同的位
constexpr void insert (const iterator &pos, const int32_t n, const bool value)
 插入n个相同的位
constexpr void insert (const iterator &pos, const int64_t n, const bool value)
 插入n个相同的位
constexpr void pop_back ()
 删除末尾位
constexpr iterator erase (const iterator &position)
 删除指定位置的位
constexpr iterator erase (const iterator &first, const iterator &last)
 删除指定范围内的位
constexpr void resize (const size_type n, const bool value=bool())
 调整大小
constexpr void clear ()
 清空位图
constexpr void swap (bitmap &other) noexcept
 交换两个位图的内容
constexpr bool equal_to (const bitmap &rhs) const noexcept(noexcept(_NEFORCE equal(this->cbegin(), this->cend(), rhs.cbegin())))
 相等比较操作符
constexpr bool less_than (const bitmap &rhs) const noexcept(noexcept(_NEFORCE lexicographical_compare(this->cbegin(), this->cend(), rhs.cbegin(), rhs.cend())))
 小于比较操作符
Public 成员函数 继承自 icomparable< bitmap >
constexpr bool operator== (const bitmap &rhs) const noexcept(noexcept(derived().equal_to(rhs)))
 相等比较运算符
constexpr bool operator!= (const bitmap &rhs) const noexcept(noexcept(!(derived().equal_to(rhs))))
 不等比较运算符
constexpr bool operator< (const bitmap &rhs) const noexcept(noexcept(derived().less_than(rhs)))
 小于比较运算符
constexpr bool operator> (const bitmap &rhs) const noexcept(noexcept(rhs.less_than(derived())))
 大于比较运算符
constexpr bool operator<= (const bitmap &rhs) const noexcept(noexcept(!(rhs.less_than(derived()))))
 小于等于比较运算符
constexpr bool operator>= (const bitmap &rhs) const noexcept(noexcept(!(derived().less_than(rhs))))
 大于等于比较运算符

详细描述

位图容器

位图是一种内存高效的布尔值容器,每个元素只占用一个位。 支持随机访问、动态增长和标准容器操作。

在文件 bitmap.hpp365 行定义.

构造及析构函数说明

◆ bitmap() [1/8]

bitmap::bitmap ( )
constexprdefaultnoexcept

默认构造函数

构造一个空位图。

被这些函数引用 bitmap(), bitmap(), bitmap(), bitmap(), bitmap(), equal_to(), less_than(), operator=(), operator=() , 以及 swap().

◆ bitmap() [2/8]

bitmap::bitmap ( const size_type word)
inlineexplicitconstexpr

构造函数,指定大小

参数
word位数

构造包含n个位的位置,所有位初始化为false。

在文件 bitmap.hpp715 行定义.

引用了 bitmap() , 以及 fill_n().

◆ bitmap() [3/8]

bitmap::bitmap ( const size_type word,
const bool value )
inlineexplicitconstexpr

构造函数,指定大小和初始值

参数
word位数
value初始值

在文件 bitmap.hpp729 行定义.

引用了 fill().

◆ bitmap() [4/8]

bitmap::bitmap ( const int32_t word,
const bool value )
inlineexplicitconstexpr

32位整数构造函数

参数
word位数
value初始值

在文件 bitmap.hpp743 行定义.

引用了 bitmap().

◆ bitmap() [5/8]

bitmap::bitmap ( const int64_t word,
const bool value )
inlineexplicitconstexpr

64位整数构造函数

参数
word位数
value初始值

在文件 bitmap.hpp751 行定义.

引用了 bitmap().

◆ bitmap() [6/8]

bitmap::bitmap ( const bitmap & other)
inlineconstexpr

拷贝构造函数

参数
other源位图

在文件 bitmap.hpp758 行定义.

引用了 bitmap(), cbegin(), cend(), empty(), move() , 以及 size().

◆ bitmap() [7/8]

bitmap::bitmap ( bitmap && other)
inlineconstexprnoexcept

移动构造函数

参数
other源位图

在文件 bitmap.hpp792 行定义.

引用了 bitmap().

◆ bitmap() [8/8]

template<typename Iterator, enable_if_t< is_iter_v< Iterator >, int > = 0>
bitmap::bitmap ( Iterator first,
Iterator last )
inlineconstexpr

范围构造函数

模板参数
Iterator迭代器类型
参数
first起始迭代器
last结束迭代器

在文件 bitmap.hpp820 行定义.

成员函数说明

◆ back() [1/2]

reference bitmap::back ( )
inlinenodiscardconstexpr

访问最后一个位

返回
最后一个位的引用

在文件 bitmap.hpp965 行定义.

引用了 end().

◆ back() [2/2]

const_reference bitmap::back ( ) const
inlinenodiscardconstexpr

常量版本,访问最后一个位

返回
最后一个位的常量值

在文件 bitmap.hpp971 行定义.

引用了 cend().

◆ begin() [1/2]

const_iterator bitmap::begin ( ) const
inlinenodiscardconstexprnoexcept

获取常量起始迭代器

返回
指向第一个位的常量迭代器

在文件 bitmap.hpp845 行定义.

引用了 cbegin().

◆ begin() [2/2]

iterator bitmap::begin ( )
inlinenodiscardconstexprnoexcept

获取起始迭代器

返回
指向第一个位的迭代器

在文件 bitmap.hpp833 行定义.

被这些函数引用 clear(), front(), insert(), operator[](), rend(), reserve() , 以及 resize().

◆ capacity()

size_type bitmap::capacity ( ) const
inlinenodiscardconstexprnoexcept

获取容量(位数)

返回
当前分配的存储可容纳的位数

在文件 bitmap.hpp927 行定义.

引用了 BITMAP_WORD_SIZE.

被这些函数引用 insert(), insert() , 以及 reserve().

◆ cbegin()

const_iterator bitmap::cbegin ( ) const
inlinenodiscardconstexprnoexcept

获取常量起始迭代器

返回
指向第一个位的常量迭代器

在文件 bitmap.hpp857 行定义.

被这些函数引用 begin(), bitmap(), crend(), equal_to(), front(), less_than(), operator[]() , 以及 size().

◆ cend()

const_iterator bitmap::cend ( ) const
inlinenodiscardconstexprnoexcept

获取常量结束迭代器

返回
指向最后一个位之后位置的常量迭代器

在文件 bitmap.hpp863 行定义.

被这些函数引用 back(), bitmap(), crbegin(), end(), equal_to(), less_than() , 以及 size().

◆ crbegin()

const_reverse_iterator bitmap::crbegin ( ) const
inlinenodiscardconstexprnoexcept

获取常量反向起始迭代器

返回
指向最后一个位的常量反向迭代器

在文件 bitmap.hpp893 行定义.

引用了 cend().

被这些函数引用 rbegin().

◆ crend()

const_reverse_iterator bitmap::crend ( ) const
inlinenodiscardconstexprnoexcept

获取常量反向结束迭代器

返回
指向第一个位之前位置的常量反向迭代器

在文件 bitmap.hpp901 行定义.

引用了 cbegin().

被这些函数引用 rend().

◆ empty()

bool bitmap::empty ( ) const
inlinenodiscardconstexprnoexcept

检查是否为空

返回
位图是否为空

在文件 bitmap.hpp921 行定义.

被这些函数引用 bitmap().

◆ end() [1/2]

const_iterator bitmap::end ( ) const
inlinenodiscardconstexprnoexcept

获取常量结束迭代器

返回
指向最后一个位之后位置的常量迭代器

在文件 bitmap.hpp851 行定义.

引用了 cend().

◆ end() [2/2]

iterator bitmap::end ( )
inlinenodiscardconstexprnoexcept

获取结束迭代器

返回
指向最后一个位之后位置的迭代器

在文件 bitmap.hpp839 行定义.

被这些函数引用 back(), clear(), erase(), erase(), insert(), insert(), insert(), push_back(), rbegin(), reserve() , 以及 resize().

◆ equal_to()

bool bitmap::equal_to ( const bitmap & rhs) const
inlinenodiscardconstexprnoexcept

相等比较操作符

参数
rhs右侧位图
返回
如果两个位图大小相等且对应位相等返回true

在文件 bitmap.hpp1160 行定义.

引用了 bitmap(), cbegin(), cend(), equal() , 以及 size().

◆ erase() [1/2]

iterator bitmap::erase ( const iterator & first,
const iterator & last )
inlineconstexpr

删除指定范围内的位

参数
first起始位置
last结束位置
返回
指向最后一个被删除元素之后位置的迭代器

在文件 bitmap.hpp1115 行定义.

引用了 end().

◆ erase() [2/2]

iterator bitmap::erase ( const iterator & position)
inlineconstexpr

删除指定位置的位

参数
position要删除的位置
返回
指向被删除元素之后位置的迭代器

在文件 bitmap.hpp1101 行定义.

引用了 end().

被这些函数引用 clear() , 以及 resize().

◆ front() [1/2]

reference bitmap::front ( )
inlinenodiscardconstexpr

访问第一个位

返回
第一个位的引用

在文件 bitmap.hpp953 行定义.

引用了 begin().

◆ front() [2/2]

const_reference bitmap::front ( ) const
inlinenodiscardconstexpr

常量版本,访问第一个位

返回
第一个位的常量值

在文件 bitmap.hpp959 行定义.

引用了 cbegin().

◆ insert() [1/6]

void bitmap::insert ( const iterator & pos,
const int32_t n,
const bool value )
inlineconstexpr

插入n个相同的位

参数
pos插入位置
n插入数量
value插入值

在文件 bitmap.hpp1077 行定义.

引用了 insert().

◆ insert() [2/6]

void bitmap::insert ( const iterator & pos,
const int64_t n,
const bool value )
inlineconstexpr

插入n个相同的位

参数
pos插入位置
n插入数量
value插入值

在文件 bitmap.hpp1087 行定义.

引用了 insert().

◆ insert() [3/6]

void bitmap::insert ( const iterator & position,
const bool * first,
const bool * last )
inlineconstexpr

插入布尔数组范围

参数
position插入位置
first数组起始指针
last数组结束指针

在文件 bitmap.hpp1038 行定义.

引用了 capacity(), distance(), end() , 以及 size().

◆ insert() [4/6]

iterator bitmap::insert ( const iterator & position,
const bool value )
inlineconstexpr

在指定位置插入位

参数
position插入位置
value要插入的值
返回
指向插入位置的迭代器

在文件 bitmap.hpp1010 行定义.

引用了 begin() , 以及 end().

被这些函数引用 insert(), insert() , 以及 resize().

◆ insert() [5/6]

void bitmap::insert ( const iterator & position,
const size_type n,
const bool value )
inlineconstexpr

插入n个相同的位

参数
position插入位置
n插入数量
value插入值

在文件 bitmap.hpp1058 行定义.

引用了 capacity(), end(), fill() , 以及 size().

◆ insert() [6/6]

template<typename Iterator>
void bitmap::insert ( iterator position,
Iterator first,
Iterator last )
inlineconstexpr

范围插入

模板参数
Iterator迭代器类型
参数
position插入位置
first起始迭代器
last结束迭代器

在文件 bitmap.hpp1028 行定义.

◆ less_than()

bool bitmap::less_than ( const bitmap & rhs) const
inlinenodiscardconstexprnoexcept

小于比较操作符

参数
rhs右侧位图
返回
按字典序比较结果

在文件 bitmap.hpp1170 行定义.

引用了 bitmap(), cbegin(), cend() , 以及 lexicographical_compare().

◆ max_size()

size_type bitmap::max_size ( ) const
inlinenodiscardconstexprnoexcept

获取最大可能位数

返回
最大位数

在文件 bitmap.hpp915 行定义.

◆ operator=() [1/2]

bitmap & bitmap::operator= ( bitmap && other)
inlineconstexprnoexcept

移动赋值运算符

参数
other源位图
返回
自身引用

在文件 bitmap.hpp805 行定义.

引用了 addressof(), bitmap() , 以及 swap().

◆ operator=() [2/2]

bitmap & bitmap::operator= ( const bitmap & other)
inlineconstexpr

拷贝赋值运算符

参数
other源位图
返回
自身引用

在文件 bitmap.hpp778 行定义.

引用了 addressof(), bitmap() , 以及 move().

◆ operator[]() [1/2]

reference bitmap::operator[] ( const size_type n)
inlinenodiscardconstexpr

下标访问操作符

参数
n索引
返回
指定位置的位的引用

在文件 bitmap.hpp936 行定义.

引用了 begin().

◆ operator[]() [2/2]

const_reference bitmap::operator[] ( const size_type n) const
inlinenodiscardconstexpr

常量下标访问操作符

参数
n索引
返回
指定位置的位的常量值

在文件 bitmap.hpp945 行定义.

引用了 cbegin().

◆ push_back()

void bitmap::push_back ( const bool value)
inlineconstexpr

在末尾插入位

参数
value要插入的值

在文件 bitmap.hpp996 行定义.

引用了 end().

◆ rbegin() [1/2]

const_reverse_iterator bitmap::rbegin ( ) const
inlinenodiscardconstexprnoexcept

获取常量反向起始迭代器

返回
指向最后一个位的常量反向迭代器

在文件 bitmap.hpp881 行定义.

引用了 crbegin().

◆ rbegin() [2/2]

reverse_iterator bitmap::rbegin ( )
inlinenodiscardconstexprnoexcept

获取反向起始迭代器

返回
指向最后一个位的反向迭代器

在文件 bitmap.hpp869 行定义.

引用了 end().

◆ rend() [1/2]

const_reverse_iterator bitmap::rend ( ) const
inlinenodiscardconstexprnoexcept

获取常量反向结束迭代器

返回
指向第一个位之前位置的常量反向迭代器

在文件 bitmap.hpp887 行定义.

引用了 crend().

◆ rend() [2/2]

reverse_iterator bitmap::rend ( )
inlinenodiscardconstexprnoexcept

获取反向结束迭代器

返回
指向第一个位之前位置的反向迭代器

在文件 bitmap.hpp875 行定义.

引用了 begin().

◆ reserve()

void bitmap::reserve ( const size_type n)
inlineconstexpr

预留容量

参数
n要预留的位数

确保位图至少有n位的容量。

在文件 bitmap.hpp979 行定义.

引用了 begin(), capacity(), end() , 以及 move().

◆ resize()

void bitmap::resize ( const size_type n,
const bool value = bool() )
inlineconstexpr

调整大小

参数
n新的大小
value用于填充新元素的默认值

在文件 bitmap.hpp1125 行定义.

引用了 begin(), end(), erase(), insert() , 以及 size().

◆ size()

size_type bitmap::size ( ) const
inlinenodiscardconstexprnoexcept

获取位数

返回
位图中的位数

在文件 bitmap.hpp909 行定义.

引用了 cbegin() , 以及 cend().

被这些函数引用 bitmap(), equal_to(), insert(), insert() , 以及 resize().

◆ swap()

void bitmap::swap ( bitmap & other)
inlineconstexprnoexcept

交换两个位图的内容

参数
other要交换的另一个位图

在文件 bitmap.hpp1142 行定义.

引用了 addressof(), bitmap() , 以及 swap().

被这些函数引用 operator=().


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