Pixie
Loading...
Searching...
No Matches
pixie::IntegerVectorBase< Impl, Value > Class Template Reference

CRTP facade for an immutable positional integer vector. More...

#include <integer_vector.h>

Inheritance diagram for pixie::IntegerVectorBase< Impl, Value >:
pixie::BasicPackedIntegerVector< AlignedStorage, Value > pixie::BasicPackedIntegerVector< ReadOnlyStorageView, Value >

Public Types

using value_type = Value
 Stored integer type.
 
using size_type = std::size_t
 Type used for element counts and zero-based positions.
 

Public Member Functions

size_type size () const
 Return the logical number of elements.
 
bool empty () const
 Return whether the vector has no elements.
 
value_type operator[] (size_type position) const
 Read the element at zero-based position without bounds checking.
 
value_type at (size_type position) const
 Read the element at zero-based position with bounds checking.
 
void copy_to (size_type begin, std::span< value_type > output) const
 Copy a checked contiguous source range into output.
 
size_type memory_usage_bytes () const
 Return total memory owned by this vector when supported.
 

Detailed Description

template<class Impl, IntegerVectorValue Value = std::uint64_t>
class pixie::IntegerVectorBase< Impl, Value >

CRTP facade for an immutable positional integer vector.

Template Parameters
ImplConcrete implementation providing size_impl(), value_at_impl(), and copy_to_impl(). It may also provide memory_usage_bytes_impl().
ValueUnsigned element type other than bool, no wider than 64 bits.

Positions are zero-based. Implementations retain ownership and lifetime semantics documented by their concrete types.

Member Function Documentation

◆ at()

template<class Impl, IntegerVectorValue Value = std::uint64_t>
value_type pixie::IntegerVectorBase< Impl, Value >::at ( size_type position) const
inline

Read the element at zero-based position with bounds checking.

Exceptions
std::out_of_rangeif position >= size().

◆ copy_to()

template<class Impl, IntegerVectorValue Value = std::uint64_t>
void pixie::IntegerVectorBase< Impl, Value >::copy_to ( size_type begin,
std::span< value_type > output ) const
inline

Copy a checked contiguous source range into output.

Copies [begin, begin + output.size()). The complete source range is validated before the implementation is called, so an invalid range leaves output unchanged.

Exceptions
std::out_of_rangeif the requested source range is invalid.

◆ memory_usage_bytes()

template<class Impl, IntegerVectorValue Value = std::uint64_t>
size_type pixie::IntegerVectorBase< Impl, Value >::memory_usage_bytes ( ) const
inline

Return total memory owned by this vector when supported.

Returns
Inline object bytes plus storage owned below the object. Borrowed backing bytes are excluded.

◆ operator[]()

template<class Impl, IntegerVectorValue Value = std::uint64_t>
value_type pixie::IntegerVectorBase< Impl, Value >::operator[] ( size_type position) const
inline

Read the element at zero-based position without bounds checking.

Parameters
positionPosition in [0, size()).
Returns
The stored value.
Precondition
position < size().

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