GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • tensorstore
  • Tutorial
  • Indexing
  • API reference
  • API reference
  • C span
  • C Utf8String
  • C SmallBitSet
  • C BitRef
  • C BitIterator
  • T pointer
  • T reference
  • T difference_type
  • T value_type

This view

  • Original page
  • New address

GeezerVison is showing google.github.io — tensorstore::BitIterator - TensorStore

#include "tensorstore/util/small_bit_set.h"
template <typename T>
class tensorstore::BitIterator;

Iterator within a packed bit sequence.

An iterator is represented by a base pointer (of type T*) to the packed bit storage and a non-negative offset (of type ptrdiff_t) in bits, and corresponds to bit offset % kBitsPerBlock of base[offset / kBitsPerBlock].

Advancing the iterator changes the offset while leaving the base pointer unchanged. Only two iterators with the same base pointer may be compared.

Template Parameters:¶
typename T¶

The unsigned integer “block” type used to store the packed bits. If const-qualified, the iterator cannot be used to modify the sequence.

Requires:¶

std::is_unsigned_v<T>.

Types¶

using pointer = BitIterator<T>;
using const_pointer = BitIterator<const T>;

Proxy pointer type.

using reference = BitRef<T>;
using const_reference = BitRef<const T>;

Proxy reference type.

using difference_type = ptrdiff_t;

Difference type.

using value_type = bool;

Value type of iterator.

using iterator_category = std::random_access_iterator_tag;

Iterator category.

Data members¶

constexpr const ptrdiff_t kBitsPerBlock = sizeof(T) * 8;

Number of bits stored per block of type T.

Constructors¶

constexpr BitIterator();

Constructs an invalid iterator.

constexpr BitIterator(T* base, ptrdiff_t offset);

Constructs from a base pointer and offset.

constexpr BitIterator(BitIterator<U> other);

Converts from a non-const iterator.

Methods¶

constexpr T* base() const;

Returns the base pointer.

constexpr ptrdiff_t offset() const;

Returns the bit offset relative to base.

constexpr BitRef<T> operator*() const;

Returns a proxy reference to the bit referenced by this iterator.

constexpr BitRef<T> operator[](ptrdiff_t offset) const;

Returns a proxy reference to the bit at the specified offset.

Arithmetic operations¶

BitIterator& operator++();

Pre-increment operator.

BitIterator& operator--();

Pre-decrement operator.

BitIterator operator++(int);

Post-increment operator.

BitIterator operator--(int);

Post-decrement operator.

friend BitIterator operator+(BitIterator it, ptrdiff_t offset);
friend BitIterator operator+(ptrdiff_t offset, BitIterator it);
BitIterator& operator+=(ptrdiff_t x);

Adds an offset to an iterator.

friend BitIterator operator-(BitIterator it, ptrdiff_t offset);
BitIterator& operator-=(ptrdiff_t x);

Subtracts an offset from an iterator.

Friend functions¶

friend constexpr ptrdiff_t operator-(BitIterator a, BitIterator b);

Returns the distance from b to a.

friend constexpr bool operator==(BitIterator a, BitIterator b);
friend constexpr bool operator!=(BitIterator a, BitIterator b);
friend constexpr bool operator<(BitIterator a, BitIterator b);
friend constexpr bool operator<=(BitIterator a, BitIterator b);
friend constexpr bool operator>(BitIterator a, BitIterator b);
friend constexpr bool operator>=(BitIterator a, BitIterator b);

Compares the positions of two iterators.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.