libsl3 1.2.41002
A C++ interface for SQLite
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
sl3::Container< ContainerType > Class Template Reference

Wrapper to provide begin, end and random access of a container. More...

#include <sl3/container.hpp>

Public Types

using conatiner_type = ContainerType
 
using iterator = typename conatiner_type::iterator
 
using const_iterator = typename conatiner_type::const_iterator
 
using value_type = typename conatiner_type::value_type
 
using reference = typename conatiner_type::reference
 
using const_reference = typename conatiner_type::const_reference
 
using size_type = typename conatiner_type::size_type
 
using container_type = ContainerType
 

Public Member Functions

 Container () noexcept
 Constructor.
 
 Container (ContainerType container) noexcept(std::is_nothrow_move_constructible< ContainerType >::value)
 Constructor.
 
 Container (std::initializer_list< value_type > container)
 Constructor.
 
 Container (const Container &)=default
 Copy Constructor.
 
Containeroperator= (const Container &)=default
 Assignment.
 
 Container (Container &&) noexcept(std::is_nothrow_move_constructible< ContainerType >::value)=default
 Move constructor.
 
Containeroperator= (Container &&)=default
 Move assignment.
 
virtual ~Container () noexcept(std::is_nothrow_destructible< ContainerType >::value)=default
 Destructor.
 
iterator begin ()
 Iterator access.
 
const_iterator begin () const
 Iterator access.
 
iterator end ()
 Iterator access.
 
const_iterator end () const
 Iterator access.
 
const_iterator cbegin () const
 Iterator access.
 
const_iterator cend () const
 Iterator access.
 
size_type size () const
 Container size.
 
reference at (size_t i)
 checked random access
 
const_reference at (size_t i) const
 checked random access
 
reference operator[] (size_t i)
 unchecked random access
 
const_reference operator[] (size_t i) const
 unchecked random access
 

Protected Attributes

ContainerType _cont
 Container T.
 

Detailed Description

template<typename ContainerType>
class sl3::Container< ContainerType >

Wrapper to provide begin, end and random access of a container.

Template Parameters
ContainerTypea container like for example std::vector

A ContainerType has begin, end, random access and size.

This class makes these methods accessible and hides the others, like a push_back, erase, ... A derived class can decide which other methods shall become visible.

Constructor & Destructor Documentation

◆ Container() [1/5]

template<typename ContainerType >
sl3::Container< ContainerType >::Container ( )
inlinenoexcept

Constructor.

Create an empty container.

◆ Container() [2/5]

template<typename ContainerType >
sl3::Container< ContainerType >::Container ( ContainerType  container)
inlinenoexcept

Constructor.

Parameters
containervalues

◆ Container() [3/5]

template<typename ContainerType >
sl3::Container< ContainerType >::Container ( std::initializer_list< value_type >  container)
inline

Constructor.

Parameters
containervalues

◆ Container() [4/5]

template<typename ContainerType >
sl3::Container< ContainerType >::Container ( const Container< ContainerType > &  )
default

Copy Constructor.

◆ Container() [5/5]

template<typename ContainerType >
sl3::Container< ContainerType >::Container ( Container< ContainerType > &&  ) const
defaultnoexcept

Move constructor.

◆ ~Container()

template<typename ContainerType >
virtual sl3::Container< ContainerType >::~Container ( )
virtualdefaultnoexcept

Destructor.

Member Function Documentation

◆ at() [1/2]

template<typename ContainerType >
reference sl3::Container< ContainerType >::at ( size_t  i)
inline

checked random access

Parameters
iindex
Exceptions
sl3::ErrOutOfRangeif index is invalid
Returns
reference to element at requested index

◆ at() [2/2]

template<typename ContainerType >
const_reference sl3::Container< ContainerType >::at ( size_t  i) const
inline

checked random access

Parameters
iindex
Exceptions
sl3::ErrOutOfRangeif index is invalid
Returns
const reference to element at requested index

◆ begin() [1/2]

template<typename ContainerType >
iterator sl3::Container< ContainerType >::begin ( )
inline

Iterator access.

Returns
requested iterator

◆ begin() [2/2]

template<typename ContainerType >
const_iterator sl3::Container< ContainerType >::begin ( ) const
inline

Iterator access.

Returns
requested iterator

◆ cbegin()

template<typename ContainerType >
const_iterator sl3::Container< ContainerType >::cbegin ( ) const
inline

Iterator access.

Returns
requested iterator

◆ cend()

template<typename ContainerType >
const_iterator sl3::Container< ContainerType >::cend ( ) const
inline

Iterator access.

Returns
requested iterator

◆ end() [1/2]

template<typename ContainerType >
iterator sl3::Container< ContainerType >::end ( )
inline

Iterator access.

Returns
requested iterator

◆ end() [2/2]

template<typename ContainerType >
const_iterator sl3::Container< ContainerType >::end ( ) const
inline

Iterator access.

Returns
requested iterator

◆ operator=() [1/2]

template<typename ContainerType >
Container & sl3::Container< ContainerType >::operator= ( const Container< ContainerType > &  )
default

Assignment.

Returns
reference to this

◆ operator=() [2/2]

template<typename ContainerType >
Container & sl3::Container< ContainerType >::operator= ( Container< ContainerType > &&  )
default

Move assignment.

Returns
reference to this

◆ operator[]() [1/2]

template<typename ContainerType >
reference sl3::Container< ContainerType >::operator[] ( size_t  i)
inline

unchecked random access

Parameters
iindex behaves undefined if given index is invalid
Returns
reference to element at requested index

◆ operator[]() [2/2]

template<typename ContainerType >
const_reference sl3::Container< ContainerType >::operator[] ( size_t  i) const
inline

unchecked random access

Parameters
iindex behaves undefined if given index is invalid
Returns
reference to element at requested index

◆ size()

template<typename ContainerType >
size_type sl3::Container< ContainerType >::size ( ) const
inline

Container size.

Returns
number of elements

Member Data Documentation

◆ _cont

template<typename ContainerType >
ContainerType sl3::Container< ContainerType >::_cont
protected

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