File tree Expand file tree Collapse file tree
include/bitlib/bit-containers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313#include " bitlib/bit-algorithms/bit_algorithm.hpp"
1414#include " bitlib/bit-containers/bit_bitsof.hpp"
1515#include " bitlib/bit-iterator/bit.hpp"
16+ #include " bitlib/bit_concepts.hpp"
1617
1718namespace bit {
1819
@@ -88,6 +89,8 @@ class bit_span : private bit_span_storage<WordType, Extent> {
8889 constexpr bit_span (WordType* s)
8990 requires(std::is_scalar_v<WordType>);
9091
92+ constexpr bit_span (bit_range auto & other);
93+
9194 // --- Observers ---
9295
9396 // Returns the number of bits in the span.
@@ -215,6 +218,16 @@ constexpr bit_span<WordType, Extent>::bit_span(WordType& word_ref)
215218 : bit_span(&word_ref) {
216219}
217220
221+ template <typename WordType, std::size_t Extent>
222+ constexpr bit_span<WordType, Extent>::bit_span(bit_range auto & other) {
223+ if constexpr (Extent == std::dynamic_extent) {
224+ this ->size_ = other.size ();
225+ } else {
226+ assert (other.size () == Extent);
227+ }
228+ this ->data_ = &(*other.begin ());
229+ }
230+
218231// --- Observers ---
219232
220233// Returns the number of bits in the span.
You can’t perform that action at this time.
0 commit comments