pstore2
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
pstore::repo::section_sparray< T > Class Template Reference

A wrapper for the sparse_array<> type which is specialized for indices of type section_kind. More...

#include <section_sparray.hpp>

Classes

class  indices
 A container which can be used to access and iterate over the available index values in the sparse array. More...
 

Public Types

using value_type = typename array_type::value_type
 
using size_type = typename array_type::size_type
 
using iterator = typename array_type::iterator
 
using const_iterator = typename array_type::const_iterator
 
using reference = value_type &
 
using const_reference = value_type const &
 

Public Member Functions

template<typename IndexIterator , typename = typename std::enable_if_t< is_section_kind_iterator<IndexIterator> ()>>
constexpr section_sparray (IndexIterator first, IndexIterator last)
 Constructs a sparse array whose available indices are defined by the iterator range from [first,last) and whose corresponding values are default constructed. More...
 
constexpr std::size_t size_bytes () const
 Returns the number of bytes of storage that are being used by this array instance.
 
indices get_indices () const noexcept
 
Element access
constexpr value_type & operator[] (section_kind k) noexcept
 
constexpr value_type const & operator[] (section_kind k) const noexcept
 
constexpr reference front () noexcept
 Returns the value associated with the first section-kind index in the container.
 
constexpr const_reference front () const noexcept
 Returns the value associated with the first section-kind index in the container.
 
constexpr reference back () noexcept
 Returns the value associated with the last section-kind index in the container.
 
constexpr const_reference back () const noexcept
 Returns the value associated with the last section-kind index in the container.
 
Iterators
iterator begin ()
 Returns an iterator to the beginning of the container.
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 Returns an iterator to the end of the container.
 
const_iterator end () const
 
const_iterator cend () const
 
Capacity
constexpr bool empty () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr bool has_index (section_kind pos) const noexcept
 Returns true if the sparse array has an index pos. More...
 

Static Public Member Functions

static constexpr std::size_t size_bytes (std::size_t members) noexcept
 Returns the number of bytes of storage that are required for an instance of section_sparray<T> where members is the number of available section-kinds. More...
 

Detailed Description

template<typename T>
class pstore::repo::section_sparray< T >

A wrapper for the sparse_array<> type which is specialized for indices of type section_kind.

Constructor & Destructor Documentation

◆ section_sparray()

template<typename T >
template<typename IndexIterator , typename >
constexpr pstore::repo::section_sparray< T >::section_sparray ( IndexIterator  first,
IndexIterator  last 
)

Constructs a sparse array whose available indices are defined by the iterator range from [first,last) and whose corresponding values are default constructed.

Member Function Documentation

◆ has_index()

template<typename T>
constexpr bool pstore::repo::section_sparray< T >::has_index ( section_kind  pos) const
inlinenoexcept

Returns true if the sparse array has an index pos.

Parameters
posThe section kind to be tested.
Returns
True if the sparse array has an index for the pos section; false otherwise.

◆ size_bytes()

template<typename T >
constexpr std::size_t pstore::repo::section_sparray< T >::size_bytes ( std::size_t  members)
staticnoexcept

Returns the number of bytes of storage that are required for an instance of section_sparray<T> where members is the number of available section-kinds.


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