System::Collections::BitArray 类
内容
[
隐藏
]BitArray class
Array of bits which can be addressed by index. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
class BitArray : public virtual System::Object,
public System::Collections::Generic::ICollection<bool>
Nested classes
- Class Enumerator
- Class Reference
方法
| 方法 | 描述 |
|---|---|
| Add(const bool&) override | 在容器末尾添加值。 |
| And(const BitArrayPtr&) | 计算两个 BitSet 之间的按位 ‘and’。 |
| BitArray(const bitset&) | 拷贝构造函数。 |
| BitArray(const BitArray&) | 拷贝构造函数。 |
| BitArray(const BitArrayPtr&) | 拷贝构造函数。 |
| BitArray(const System::ArrayPtr<bool>&) | 拷贝构造函数。 |
| BitArray(const System::ArrayPtr<uint8_t>&) | 拷贝构造函数。 |
| BitArray(const System::ArrayPtr<int>&) | 拷贝构造函数。 |
| BitArray(int, bool) | 填充构造函数。 |
| Clear() override | 删除所有元素。 |
| Contains(const bool&) const override | 检查容器中是否存在特定值。未实现。 |
| CopyTo(System::ArrayPtr<bool>, int) override | 将数据复制到现有数组元素。 |
| data() | 底层数据结构访问。 |
| data() const | 底层数据结构访问。 |
| Get(int) const | 获取 BitArray 元素。 |
| get_Count() const override | 获取容器大小。 |
| get_Length() const | 获取容器大小。 |
| GetEnumerator() override | 创建枚举器对象。 |
| idx_get(int) const | 获取函数。 |
| idx_set(int, bool) | 设置函数。 |
| Not() | 对 BitSet 取反。 |
| operator!=(const BitArray&) const | 按位比较运算符。 |
| operator==(const BitArray&) const | 按位比较运算符。 |
| operator[](int) | 访问器函数。 |
| Or(const BitArrayPtr&) | 计算两个 BitSet 之间的按位 ‘or’。 |
| Remove(const bool&) override | 返回指定值的第一次出现。未实现。 |
| Set(int, bool) | 设置 BitArray 元素。 |
| SetAll(bool) | 将所有元素设置为特定值。 |
| SetTemplateWeakPtr(uint32_t) override | 弱模板参数机制的正式实现;不适用于此类。 |
| virtualizeBeginConstIterator() const override | 获取当前容器的 begin const 迭代器的实现。 |
| virtualizeBeginIterator() override | 获取当前容器的 begin 迭代器的实现。 |
| virtualizeEndConstIterator() const override | 获取当前容器的 end const 迭代器的实现。 |
| virtualizeEndIterator() override | 获取当前容器的 end 迭代器的实现。 |
| Xor(const BitArrayPtr&) | 计算两个 BitSet 之间的按位 ‘xor’。 |
Typedefs
| 类型定义 | 描述 |
|---|---|
| bitset | RTTI 信息。 |
备注
#include <system/collections/bitarray.h>
#include <system/smart_ptr.h>
using namespace System;
using namespace System::Collections::Generic;
void Print(const System::SmartPtr<System::Collections::Generic::IEnumerable<bool>> &bitArray)
{
for (const auto item: bitArray)
{
std::cout << item << ' ';
}
std::cout << std::endl;
}
int main()
{
// 构造 BitArray 类的新实例。
auto bitArray = MakeObject<System::Collections::BitArray>(3);
// 打印值。
Print(bitArray);
return 0;
}
/*
This code example produces the following output:
0 0 0
*/
另见
- Class Object
- Class ICollection
- Namespace System::Collections
- Library Aspose.Font for C++