avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::hw::RangeView< T > Class Template Reference

Non-owning view over a contiguous array.

#include <hwcontext.h>

Public Types

using value_type = T
 Element type of the view.
using iterator = T*
 Iterator type of the view.
using const_iterator = const T*
 Const iterator type of the view.

Public Member Functions

 RangeView ()=default
 Create an empty view.
 RangeView (T *data, size_t size) noexcept
 Wrap an existing array.
T * begin () const noexcept
 First element.
T * end () const noexcept
 One past the last element.
size_t size () const noexcept
 Number of elements.
bool empty () const noexcept
 Whether the view has no elements.
T & operator[] (size_t index) const noexcept
 Element access.
std::vector< T > toVector () const
 Copy the view into a vector.

Constructor & Destructor Documentation

◆ RangeView()

template<typename T>
av::hw::RangeView< T >::RangeView ( T * data,
size_t size )
inlinenoexcept
Parameters
datapointer to the first element; may be null when size is zero
sizenumber of elements
Note
Non-owning: the array must outlive the view.

Member Function Documentation

◆ begin()

template<typename T>
T * av::hw::RangeView< T >::begin ( ) const
inlinenoexcept
Returns
a pointer to the first element, or nullptr when empty

◆ empty()

template<typename T>
bool av::hw::RangeView< T >::empty ( ) const
inlinenoexcept
Returns
true when the element count is zero

◆ end()

template<typename T>
T * av::hw::RangeView< T >::end ( ) const
inlinenoexcept
Returns
the end pointer of the view

◆ operator[]()

template<typename T>
T & av::hw::RangeView< T >::operator[] ( size_t index) const
inlinenoexcept
Parameters
indexzero-based index; must be less than size()
Returns
a reference into the viewed array

◆ size()

template<typename T>
size_t av::hw::RangeView< T >::size ( ) const
inlinenoexcept
Returns
the element count

◆ toVector()

template<typename T>
std::vector< T > av::hw::RangeView< T >::toVector ( ) const
inline
Returns
a vector with the same elements; empty for an empty view

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