StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
StormByte::Iterable< Container > Class Template Reference

A generic iterable container wrapper. More...

#include <iterable.hxx>

Classes

class  ConstIterator
 Wrapper const iterator for Iterable. More...
 
class  Iterator
 Wrapper iterator for Iterable. More...
 

Public Types

using value_type = typename Container::value_type
 
using size_type = typename Container::size_type
 
using difference_type = typename Container::difference_type
 
using reference = typename Container::reference
 
using const_reference = typename Container::const_reference
 
using pointer = typename Container::pointer
 
using const_pointer = typename Container::const_pointer
 
using iterator = Iterator
 
using const_iterator = ConstIterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

 Iterable ()=default
 Default constructor.
 
 Iterable (const Container &data)
 Constructor from existing container.
 
 Iterable (Container &&data)
 Move constructor from existing container.
 
 Iterable (const Iterable &)=default
 Copy constructor.
 
 Iterable (Iterable &&)=default
 Move constructor.
 
virtual ~Iterable ()=default
 Virtual destructor.
 
Iterableoperator= (const Iterable &)=default
 Copy assignment operator.
 
Iterableoperator= (Iterable &&)=default
 Move assignment operator.
 
iterator begin () noexcept
 Gets begin iterator.
 
iterator end () noexcept
 Gets end iterator.
 
const_iterator begin () const noexcept
 Gets const begin iterator.
 
const_iterator end () const noexcept
 Gets const end iterator.
 
const_iterator cbegin () const noexcept
 Gets const begin iterator.
 
const_iterator cend () const noexcept
 Gets const end iterator.
 
reverse_iterator rbegin () noexcept
 Gets reverse begin iterator.
 
reverse_iterator rend () noexcept
 Gets reverse end iterator.
 
const_reverse_iterator rbegin () const noexcept
 Gets const reverse begin iterator.
 
const_reverse_iterator rend () const noexcept
 Gets const reverse end iterator.
 
const_reverse_iterator crbegin () const noexcept
 Gets const reverse begin iterator.
 
const_reverse_iterator crend () const noexcept
 Gets const reverse end iterator.
 
size_type size () const noexcept
 Gets the size of the container.
 
bool empty () const noexcept
 Checks if the container is empty.
 
reference operator[] (size_type i)
 Access element at given index.
 
const_reference operator[] (size_type i) const
 Access element at given index (const version)
 
void add (const value_type &value)
 Adds an element to the container.
 
void add (value_type &&value)
 Adds an element to the container (move version)
 

Protected Attributes

Container m_data
 Underlying container.
 

Detailed Description

template<typename Container>
class StormByte::Iterable< Container >

A generic iterable container wrapper.

Template Parameters
ContainerThe underlying container type

The Iterable class template provides a generic wrapper around standard container types, enabling iteration capabilities with custom iterator and const iterator classes.

Constructor & Destructor Documentation

◆ Iterable() [1/2]

template<typename Container >
StormByte::Iterable< Container >::Iterable ( const Container &  data)
inlineexplicit

Constructor from existing container.

Parameters
dataThe container to initialize the Iterable with

◆ Iterable() [2/2]

template<typename Container >
StormByte::Iterable< Container >::Iterable ( Container &&  data)
inlineexplicit

Move constructor from existing container.

Parameters
dataThe container to initialize the Iterable with

Member Function Documentation

◆ add() [1/2]

template<typename Container >
void StormByte::Iterable< Container >::add ( const value_type &  value)
inline

Adds an element to the container.

Parameters
valueThe element to add

◆ add() [2/2]

template<typename Container >
void StormByte::Iterable< Container >::add ( value_type &&  value)
inline

Adds an element to the container (move version)

Parameters
valueThe element to add

◆ begin() [1/2]

template<typename Container >
const_iterator StormByte::Iterable< Container >::begin ( ) const
inlinenoexcept

Gets const begin iterator.

Returns
Const iterator to the beginning of the container

◆ begin() [2/2]

template<typename Container >
iterator StormByte::Iterable< Container >::begin ( )
inlinenoexcept

Gets begin iterator.

Returns
Iterator to the beginning of the container

◆ cbegin()

template<typename Container >
const_iterator StormByte::Iterable< Container >::cbegin ( ) const
inlinenoexcept

Gets const begin iterator.

Returns
Const iterator to the beginning of the container

◆ cend()

template<typename Container >
const_iterator StormByte::Iterable< Container >::cend ( ) const
inlinenoexcept

Gets const end iterator.

Returns
Const iterator to the end of the container

◆ crbegin()

template<typename Container >
const_reverse_iterator StormByte::Iterable< Container >::crbegin ( ) const
inlinenoexcept

Gets const reverse begin iterator.

Returns
Const reverse iterator to the beginning of the container

◆ crend()

template<typename Container >
const_reverse_iterator StormByte::Iterable< Container >::crend ( ) const
inlinenoexcept

Gets const reverse end iterator.

Returns
Const reverse iterator to the end of the container

◆ empty()

template<typename Container >
bool StormByte::Iterable< Container >::empty ( ) const
inlinenoexcept

Checks if the container is empty.

Returns
True if the container is empty, false otherwise

◆ end() [1/2]

template<typename Container >
const_iterator StormByte::Iterable< Container >::end ( ) const
inlinenoexcept

Gets const end iterator.

Returns
Const iterator to the end of the container

◆ end() [2/2]

template<typename Container >
iterator StormByte::Iterable< Container >::end ( )
inlinenoexcept

Gets end iterator.

Returns
Iterator to the end of the container

◆ operator=() [1/2]

template<typename Container >
Iterable & StormByte::Iterable< Container >::operator= ( const Iterable< Container > &  )
default

Copy assignment operator.

Parameters
otherThe Iterable to copy from
Returns
Reference to this Iterable

◆ operator=() [2/2]

template<typename Container >
Iterable & StormByte::Iterable< Container >::operator= ( Iterable< Container > &&  )
default

Move assignment operator.

Parameters
otherThe Iterable to move from
Returns
Reference to this Iterable

◆ operator[]() [1/2]

template<typename Container >
reference StormByte::Iterable< Container >::operator[] ( size_type  i)
inline

Access element at given index.

Parameters
iIndex of the element to access
Returns
Reference to the element at index i

◆ operator[]() [2/2]

template<typename Container >
const_reference StormByte::Iterable< Container >::operator[] ( size_type  i) const
inline

Access element at given index (const version)

Parameters
iIndex of the element to access
Returns
Const reference to the element at index i

◆ rbegin() [1/2]

template<typename Container >
const_reverse_iterator StormByte::Iterable< Container >::rbegin ( ) const
inlinenoexcept

Gets const reverse begin iterator.

Returns
Const reverse iterator to the beginning of the container

◆ rbegin() [2/2]

template<typename Container >
reverse_iterator StormByte::Iterable< Container >::rbegin ( )
inlinenoexcept

Gets reverse begin iterator.

Returns
Reverse iterator to the beginning of the container

◆ rend() [1/2]

template<typename Container >
const_reverse_iterator StormByte::Iterable< Container >::rend ( ) const
inlinenoexcept

Gets const reverse end iterator.

Returns
Const reverse iterator to the end of the container

◆ rend() [2/2]

template<typename Container >
reverse_iterator StormByte::Iterable< Container >::rend ( )
inlinenoexcept

Gets reverse end iterator.

Returns
Reverse iterator to the end of the container

◆ size()

template<typename Container >
size_type StormByte::Iterable< Container >::size ( ) const
inlinenoexcept

Gets the size of the container.

Returns
Number of elements in the container

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