Zip and Skip Tries
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator Class Reference

An iterator class for traversing the characters within a BitString. More...

Collaboration diagram for BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator:
Collaboration graph
[legend]

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = CHAR_T
 
using difference_type = std::ptrdiff_t
 
using pointer = const CHAR_T *
 
using reference = CHAR_T
 

Public Member Functions

 Iterator (const BitString &bs, size_t index)
 Constructs an iterator pointing to a specific character index.
 
CHAR_T operator* () const noexcept
 Dereferences the iterator to get the character at the current position.
 
Iteratoroperator++ () noexcept
 Pre-increments the iterator to point to the next character.
 
Iterator operator++ (int) noexcept
 Post-increments the iterator.
 
bool operator== (const Iterator &other) const noexcept
 Compares this iterator with another for equality.
 

Private Attributes

const BitStringm_bs
 Reference to the BitString being iterated over.
 
size_t m_index
 Current character index.
 

Detailed Description

template<typename CHAR_T, unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
class BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator

An iterator class for traversing the characters within a BitString.

Provides read-only, forward iteration over the characters stored in the BitString. Dereferencing yields the character value, and incrementing moves to the next character.

Definition at line 364 of file BitString.cuh.

Member Typedef Documentation

◆ difference_type

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
using BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::difference_type = std::ptrdiff_t

Definition at line 369 of file BitString.cuh.

◆ iterator_category

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
using BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::iterator_category = std::forward_iterator_tag

Definition at line 367 of file BitString.cuh.

◆ pointer

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
using BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::pointer = const CHAR_T*

Definition at line 370 of file BitString.cuh.

◆ reference

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
using BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::reference = CHAR_T

Definition at line 371 of file BitString.cuh.

◆ value_type

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
using BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::value_type = CHAR_T

Definition at line 368 of file BitString.cuh.

Constructor & Destructor Documentation

◆ Iterator()

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::Iterator ( const BitString bs,
size_t  index 
)
inline

Constructs an iterator pointing to a specific character index.

Parameters
bsThe BitString to iterate over.
indexThe initial character index.

Definition at line 378 of file BitString.cuh.

379 : m_bs(bs), m_index(index)
380 {
381 // Body intentionally empty
382 }
const BitString & m_bs
Reference to the BitString being iterated over.
size_t m_index
Current character index.
T * alloc_to_device(size_t size)
Allocates memory on the CUDA device.

Member Function Documentation

◆ operator*()

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
CHAR_T BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::operator* ( ) const
inlinenoexcept

Dereferences the iterator to get the character at the current position.

Returns
CHAR_T The character value.

Definition at line 388 of file BitString.cuh.

389 {
390 return m_bs[m_index];
391 }

◆ operator++() [1/2]

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
Iterator & BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::operator++ ( )
inlinenoexcept

Pre-increments the iterator to point to the next character.

Returns
Iterator& A reference to the incremented iterator.

Definition at line 397 of file BitString.cuh.

398 {
399 ++m_index;
400 return *this;
401 }

◆ operator++() [2/2]

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
Iterator BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::operator++ ( int  )
inlinenoexcept

Post-increments the iterator.

Returns
Iterator A copy of the iterator before incrementing.
Note
Prefer pre-increment (++it) when possible for efficiency.

Definition at line 408 of file BitString.cuh.

409 {
410 Iterator temp = *this;
411 ++(*this);
412 return temp;
413 }
Iterator(const BitString &bs, size_t index)
Constructs an iterator pointing to a specific character index.

◆ operator==()

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
bool BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::operator== ( const Iterator other) const
inlinenoexcept

Compares this iterator with another for equality.

Parameters
otherThe iterator to compare against.
Returns
bool True if both iterators point to the same index within the same BitString (implicitly).

Definition at line 421 of file BitString.cuh.

422 {
423 return m_index == other.m_index;
424 }

Member Data Documentation

◆ m_bs

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
const BitString& BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::m_bs
private

Reference to the BitString being iterated over.

Definition at line 428 of file BitString.cuh.

◆ m_index

template<typename CHAR_T , unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
size_t BitString< CHAR_T, CHAR_SIZE_BITS >::Iterator::m_index
private

Current character index.

Definition at line 430 of file BitString.cuh.


The documentation for this class was generated from the following file: