sparrow 0.9.0
Loading...
Searching...
No Matches
sparrow::list_value Class Reference

#include <list_value.hpp>

Public Types

using value_type = array_traits::value_type
 
using const_reference = array_traits::const_reference
 
using size_type = std::size_t
 
using list_value_reverse_iterator = std::reverse_iterator<list_value_iterator>
 

Public Member Functions

 list_value ()=default
 Default constructor creating an empty list view.
 
 list_value (const array_wrapper *flat_array, size_type index_begin, size_type index_end)
 Constructs list view over specified array range.
 
size_type size () const
 Gets the number of elements in the list.
 
bool empty () const
 Checks if the list is empty.
 
const_reference operator[] (size_type i) const
 Gets element at specified position without bounds checking.
 
const_reference front () const
 Gets reference to the first element.
 
const_reference back () const
 Gets reference to the last element.
 
list_value_iterator begin ()
 Gets iterator to the beginning of the list.
 
list_value_iterator begin () const
 Gets const iterator to the beginning of the list.
 
list_value_iterator cbegin () const
 Gets const iterator to the beginning of the list.
 
list_value_iterator end ()
 Gets iterator to the end of the list.
 
list_value_iterator end () const
 Gets const iterator to the end of the list.
 
list_value_iterator cend () const
 Gets const iterator to the end of the list.
 
list_value_reverse_iterator rbegin ()
 Gets reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator rbegin () const
 Gets const reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator crbegin () const
 Gets const reverse iterator to the beginning of reversed list.
 
list_value_reverse_iterator rend ()
 Gets reverse iterator to the end of reversed list.
 
list_value_reverse_iterator rend () const
 Gets const reverse iterator to the end of reversed list.
 
list_value_reverse_iterator crend () const
 Gets const reverse iterator to the end of reversed list.
 

Detailed Description

Definition at line 199 of file list_value.hpp.

Member Typedef Documentation

◆ const_reference

◆ list_value_reverse_iterator

Definition at line 206 of file list_value.hpp.

◆ size_type

using sparrow::list_value::size_type = std::size_t

Definition at line 205 of file list_value.hpp.

◆ value_type

Constructor & Destructor Documentation

◆ list_value() [1/2]

sparrow::list_value::list_value ( )
default

Default constructor creating an empty list view.

Postcondition
size() returns 0
empty() returns true
All iterators are equal (begin() == end())

◆ list_value() [2/2]

sparrow::list_value::list_value ( const array_wrapper * flat_array,
size_type index_begin,
size_type index_end )

Constructs list view over specified array range.

Parameters
flat_arrayPointer to the flattened array containing list data
index_beginStarting index of the list (inclusive)
index_endEnding index of the list (exclusive)
Precondition
flat_array must be a valid pointer to array_wrapper
index_begin must be <= index_end
index_end must be <= flat_array->size()
Postcondition
size() returns (index_end - index_begin)
List provides view over elements [index_begin, index_end)
Iterators are valid for traversing the specified range

Member Function Documentation

◆ back()

const_reference sparrow::list_value::back ( ) const
nodiscard

Gets reference to the last element.

Returns
Const reference to the last element
Precondition
List must not be empty (!empty())
Postcondition
Returns valid reference to last element
Equivalent to (*this)[size() - 1]

◆ begin() [1/2]

list_value_iterator sparrow::list_value::begin ( )
nodiscard

Gets iterator to the beginning of the list.

Returns
Iterator pointing to the first element
Postcondition
Iterator is valid for list traversal
For empty list, equals end()

◆ begin() [2/2]

list_value_iterator sparrow::list_value::begin ( ) const
nodiscard

Gets const iterator to the beginning of the list.

Returns
Const iterator pointing to the first element
Postcondition
Iterator is valid for list traversal
For empty list, equals end()

◆ cbegin()

list_value_iterator sparrow::list_value::cbegin ( ) const
nodiscard

Gets const iterator to the beginning of the list.

Returns
Const iterator pointing to the first element
Postcondition
Iterator is valid for list traversal
Guarantees const iterator even for non-const list

◆ cend()

list_value_iterator sparrow::list_value::cend ( ) const
nodiscard

Gets const iterator to the end of the list.

Returns
Const iterator pointing past the last element
Postcondition
Iterator marks the end of the list range
Guarantees const iterator even for non-const list

◆ crbegin()

list_value_reverse_iterator sparrow::list_value::crbegin ( ) const
nodiscard

Gets const reverse iterator to the beginning of reversed list.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
Guarantees const iterator even for non-const list

◆ crend()

list_value_reverse_iterator sparrow::list_value::crend ( ) const
nodiscard

Gets const reverse iterator to the end of reversed list.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Guarantees const iterator even for non-const list

◆ empty()

bool sparrow::list_value::empty ( ) const
nodiscard

Checks if the list is empty.

Returns
true if list contains no elements, false otherwise
Postcondition
Return value equals (size() == 0)
Equivalent to (begin() == end())

◆ end() [1/2]

list_value_iterator sparrow::list_value::end ( )
nodiscard

Gets iterator to the end of the list.

Returns
Iterator pointing past the last element
Postcondition
Iterator marks the end of the list range
Not dereferenceable

◆ end() [2/2]

list_value_iterator sparrow::list_value::end ( ) const
nodiscard

Gets const iterator to the end of the list.

Returns
Const iterator pointing past the last element
Postcondition
Iterator marks the end of the list range
Not dereferenceable

◆ front()

const_reference sparrow::list_value::front ( ) const
nodiscard

Gets reference to the first element.

Returns
Const reference to the first element
Precondition
List must not be empty (!empty())
Postcondition
Returns valid reference to first element
Equivalent to (*this)[0]

◆ operator[]()

const_reference sparrow::list_value::operator[] ( size_type i) const

Gets element at specified position without bounds checking.

Parameters
iIndex of element to access
Returns
Const reference to element at position i
Precondition
i must be < size()
Postcondition
Returns valid reference to element
Reference remains valid while underlying array exists

◆ rbegin() [1/2]

list_value_reverse_iterator sparrow::list_value::rbegin ( )
nodiscard

Gets reverse iterator to the beginning of reversed list.

Returns
Reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
For empty list, equals rend()

◆ rbegin() [2/2]

list_value_reverse_iterator sparrow::list_value::rbegin ( ) const
nodiscard

Gets const reverse iterator to the beginning of reversed list.

Returns
Const reverse iterator pointing to the last element
Postcondition
Iterator is valid for reverse traversal
For empty list, equals rend()

◆ rend() [1/2]

list_value_reverse_iterator sparrow::list_value::rend ( )
nodiscard

Gets reverse iterator to the end of reversed list.

Returns
Reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Not dereferenceable

◆ rend() [2/2]

list_value_reverse_iterator sparrow::list_value::rend ( ) const
nodiscard

Gets const reverse iterator to the end of reversed list.

Returns
Const reverse iterator pointing before the first element
Postcondition
Iterator marks the end of reverse traversal
Not dereferenceable

◆ size()

size_type sparrow::list_value::size ( ) const
nodiscard

Gets the number of elements in the list.

Returns
Number of elements in the list view
Postcondition
Returns non-negative count
Equals (index_end - index_begin)

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