Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/bitlib/bit-containers/bit_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class bit_array : public bit_array_base<bit_array<T, N, V, W>, T, W, detail::bit

alignas(static_cast<size_t>(V)) std::array<word_type, AlignedWords> storage;

friend class bit_array<T, std::dynamic_extent, V, W>;
public:
/*
* Constructors, copies and moves...
Expand Down
13 changes: 13 additions & 0 deletions include/bitlib/bit-containers/bit_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "bitlib/bit-algorithms/bit_algorithm.hpp"
#include "bitlib/bit-containers/bit_bitsof.hpp"
#include "bitlib/bit-iterator/bit.hpp"
#include "bitlib/bit_concepts.hpp"

namespace bit {

Expand Down Expand Up @@ -88,6 +89,8 @@ class bit_span : private bit_span_storage<WordType, Extent> {
constexpr bit_span(WordType* s)
requires(std::is_scalar_v<WordType>);

constexpr bit_span(bit_range auto& other);

// --- Observers ---

// Returns the number of bits in the span.
Expand Down Expand Up @@ -215,6 +218,16 @@ constexpr bit_span<WordType, Extent>::bit_span(WordType& word_ref)
: bit_span(&word_ref) {
}

template <typename WordType, std::size_t Extent>
constexpr bit_span<WordType, Extent>::bit_span(bit_range auto& other) {
if constexpr (Extent == std::dynamic_extent) {
this->size_ = other.size();
} else {
assert(other.size() == Extent);
}
this->data_ = &(*other.begin());
}

// --- Observers ---

// Returns the number of bits in the span.
Expand Down
9 changes: 9 additions & 0 deletions include/bitlib/bit-iterator/bit_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class bit_iterator
public:
template <class T>
constexpr bit_iterator& operator=(const bit_iterator<T>& other);
constexpr bit_iterator& operator=(const bit_iterator& other);

// Access
public:
Expand Down Expand Up @@ -167,6 +168,14 @@ constexpr bit_iterator<Iterator>& bit_iterator<Iterator>::operator=(
assert(_position < bitsof<word_type>());
return *this;
}
template <class Iterator>
constexpr bit_iterator<Iterator>& bit_iterator<Iterator>::operator=(
const bit_iterator<Iterator>& other) {
_current = other._current;
_position = other._position;
assert(_position < bitsof<word_type>());
return *this;
}
// -------------------------------------------------------------------------- //


Expand Down
Loading