blob: 72920d295bf9870c5fb8b4c805c1dd8b37ba87c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef MYGRATE_BITSET_H
#define MYGRATE_BITSET_H
#include <cstddef>
#include <iterator>
#include <span>
namespace MyGrate {
class BitSet {
public:
class Iterator {
public:
using iterator_category = std::forward_iterator_tag;
using difference_type = int;
using value_type = bool;
using pointer = bool *;
using reference = bool;
explicit Iterator();
explicit Iterator(const std::byte *);
bool operator*() const;
bool operator!=(const Iterator &) const;
bool operator==(const Iterator &) const;
Iterator & operator++();
Iterator operator++(int);
private:
const std::byte * b;
std::byte m {1};
};
explicit BitSet(const std::span<const std::byte> b);
std::size_t size() const;
Iterator begin() const;
Iterator end() const;
private:
std::span<const std::byte> bytes;
};
}
#endif
|