10#ifndef BITINDICESVIEW_HPP
11#define BITINDICESVIEW_HPP
13#include "bitdefines.hpp"
32template< std::
size_t N >
52 using pointer = element_type*;
53 using const_pointer =
const element_type*;
54 using reference = element_type&;
55 using const_reference =
const element_type&;
56 using iterator = pointer;
57 using const_iterator = const_pointer;
72 : mIndices{ &index }, mSize{ 1 } {}
90 template< std::
size_t N >
121 constexpr auto data() const noexcept -> const_pointer {
129 constexpr auto size() const noexcept -> size_type {
137 constexpr auto begin() const noexcept -> iterator {
145 constexpr auto end() const noexcept -> iterator {
153 constexpr auto cbegin() const noexcept -> const_iterator {
161 constexpr auto cend() const noexcept -> const_iterator {
162 return mIndices + mSize;
169 constexpr auto empty() const noexcept ->
bool {
170 return mIndices ==
nullptr;
174 const_pointer mIndices;
178 : mIndices{
size == 0 ? nullptr : indices },
179 mSize{
static_cast< size_type
>(
size ) } {}
BitIndicesView(std::initializer_list< value_type > indices) noexcept
Constructs a BitIndicesView referencing the indices in the given initializer list.
Definition bitindicesview.hpp:114
constexpr BitIndicesView() noexcept
Constructs an empty BitIndicesView.
Definition bitindicesview.hpp:64
BitIndicesView(const IndicesVector &indices) noexcept
Constructs a BitIndicesView referencing the indices stored in the given vector.
Definition bitindicesview.hpp:81
constexpr auto cbegin() const noexcept -> const_iterator
Definition bitindicesview.hpp:153
constexpr BitIndicesView(const std::array< U, N > &indices) noexcept
Constructs a BitIndicesView referencing the indices stored in the given std::array.
Definition bitindicesview.hpp:106
constexpr auto end() const noexcept -> iterator
Definition bitindicesview.hpp:145
constexpr auto begin() const noexcept -> iterator
Definition bitindicesview.hpp:137
constexpr auto empty() const noexcept -> bool
Definition bitindicesview.hpp:169
constexpr BitIndicesView(const_reference index) noexcept
Constructs a BitIndicesView referencing a single index.
Definition bitindicesview.hpp:71
constexpr auto data() const noexcept -> const_pointer
Definition bitindicesview.hpp:121
constexpr BitIndicesView(element_type(&indices)[N]) noexcept
Constructs a BitIndicesView referencing the indices stored in the given C array.
Definition bitindicesview.hpp:91
constexpr auto size() const noexcept -> size_type
Definition bitindicesview.hpp:129
constexpr auto cend() const noexcept -> const_iterator
Definition bitindicesview.hpp:161
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:29
std::vector< std::uint32_t > IndicesVector
A dynamically-sized vector of archive item indices.
Definition bitindicesview.hpp:25
std::array< std::uint32_t, N > IndicesArray
A fixed-size array of N archive item indices.
Definition bitindicesview.hpp:33