Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::MonotonicVector< TYPE > Class Template Reference

Defines a monotonic vector container type. More...

#include <monotonic_vector.h>

Public Types

using IteratorType = typename std::vector< TYPE >::iterator
 Element iterator. More...
 
using ConstIteratorType = typename std::vector< TYPE >::const_iterator
 Read-only element iterator. More...
 

Public Member Functions

 MonotonicVector (std::vector< TYPE > &values)
 Initialises a new instance of the MonotonicVector class. More...
 
std::size_t size () const noexcept
 Gets the number of elements. More...
 
const TYPE & at (std::size_t index) const
 Gets a specified element with bounds checking. More...
 
TYPE & operator[] (std::size_t index)
 Gets a specified element with bounds checking. More...
 
const TYPE & operator[] (std::size_t index) const
 Gets a specified read-only element with bounds checking. More...
 
IteratorType begin () noexcept
 Gets an iterator to the beginning of the elements. More...
 
IteratorType end () noexcept
 Gets an iterator to the element following the element of the vector. More...
 
ConstIteratorType begin () const noexcept
 Gets an read-only iterator to the beginning of the elements. More...
 
ConstIteratorType end () const noexcept
 Gets an read-only iterator to the element following the element of the vector. More...
 
ConstIteratorType cbegin () const noexcept
 Gets an read-only iterator to the beginning of the elements. More...
 
ConstIteratorType cend () const noexcept
 Gets an read-only iterator to the element following the element of the vector. More...
 

Detailed Description

template<core::Numerical TYPE>
class hgps::MonotonicVector< TYPE >

Defines a monotonic vector container type.

Template Parameters
TYPEThe type of the elements

Member Typedef Documentation

◆ ConstIteratorType

template<core::Numerical TYPE>
using hgps::MonotonicVector< TYPE >::ConstIteratorType = typename std::vector<TYPE>::const_iterator

Read-only element iterator.

◆ IteratorType

template<core::Numerical TYPE>
using hgps::MonotonicVector< TYPE >::IteratorType = typename std::vector<TYPE>::iterator

Element iterator.

Constructor & Destructor Documentation

◆ MonotonicVector()

template<core::Numerical TYPE>
hgps::MonotonicVector< TYPE >::MonotonicVector ( std::vector< TYPE > &  values)
inline

Initialises a new instance of the MonotonicVector class.

Parameters
valuesThe monotonic values
Exceptions
std::invalid_argumentif the values are not strict monotonic.
Here is the call graph for this function:

Member Function Documentation

◆ at()

template<core::Numerical TYPE>
const TYPE& hgps::MonotonicVector< TYPE >::at ( std::size_t  index) const
inline

Gets a specified element with bounds checking.

Parameters
indexThe element index
Returns
Reference to the requested element.

◆ begin() [1/2]

template<core::Numerical TYPE>
ConstIteratorType hgps::MonotonicVector< TYPE >::begin ( ) const
inlinenoexcept

Gets an read-only iterator to the beginning of the elements.

Returns
Iterator to the first element

◆ begin() [2/2]

template<core::Numerical TYPE>
IteratorType hgps::MonotonicVector< TYPE >::begin ( )
inlinenoexcept

Gets an iterator to the beginning of the elements.

Returns
Iterator to the first element

◆ cbegin()

template<core::Numerical TYPE>
ConstIteratorType hgps::MonotonicVector< TYPE >::cbegin ( ) const
inlinenoexcept

Gets an read-only iterator to the beginning of the elements.

Returns
Iterator to the first element

◆ cend()

template<core::Numerical TYPE>
ConstIteratorType hgps::MonotonicVector< TYPE >::cend ( ) const
inlinenoexcept

Gets an read-only iterator to the element following the element of the vector.

Returns
Iterator to the element following the last element.

◆ end() [1/2]

template<core::Numerical TYPE>
ConstIteratorType hgps::MonotonicVector< TYPE >::end ( ) const
inlinenoexcept

Gets an read-only iterator to the element following the element of the vector.

Returns
Iterator to the element following the last element.

◆ end() [2/2]

template<core::Numerical TYPE>
IteratorType hgps::MonotonicVector< TYPE >::end ( )
inlinenoexcept

Gets an iterator to the element following the element of the vector.

Returns
Iterator to the element following the last element.

◆ operator[]() [1/2]

template<core::Numerical TYPE>
TYPE& hgps::MonotonicVector< TYPE >::operator[] ( std::size_t  index)
inline

Gets a specified element with bounds checking.

Parameters
indexThe element index
Returns
Reference to the requested element.

◆ operator[]() [2/2]

template<core::Numerical TYPE>
const TYPE& hgps::MonotonicVector< TYPE >::operator[] ( std::size_t  index) const
inline

Gets a specified read-only element with bounds checking.

Parameters
indexThe element index
Returns
Reference to the requested element.

◆ size()

template<core::Numerical TYPE>
std::size_t hgps::MonotonicVector< TYPE >::size ( ) const
inlinenoexcept

Gets the number of elements.

Returns
NUmber of elements
Here is the caller graph for this function:

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