staticlib_io  1.2.11
 All Classes Namespaces Files Functions Variables
Public Member Functions | List of all members
staticlib::io::span< T > Class Template Reference

Non-owning range of elements in contiguous memory. More...

#include <staticlib/io/span.hpp>

Public Member Functions

template<typename IntType >
 span (T *buffer, IntType length)
 Constructor.
template<typename Convertible , size_t Length>
 span (std::array< Convertible, Length > &buffer)
 Constructor from array.
 span (std::vector< T > &buffer)
 Constructor from vector.
template<typename Convertible >
 span (std::vector< Convertible > &buffer)
 Constructor from vector.
 span (std::string &buffer)
 Constructor from string, for char and const charspans only.
 span (const std::string &buffer)
 Constructor from string, for const charspans only.
template<size_t Size>
 span (const char(&buffer)[Size])
 Constructor from string literal.
 span (const span< T > &other)
 Copy constructor.
span< T > & operator= (const span< T > &other)
 Copy assignment operator.
T & operator[] (size_t index) const
 Element access checked operation.
T * data () const STATICLIB_NOEXCEPT
 Data accessor.
bool empty () const STATICLIB_NOEXCEPT
 Emptiness check.
bool is_empty () const STATICLIB_NOEXCEPT
 Emptiness check.
bool is_null () const STATICLIB_NOEXCEPT
 NULL check.
size_t size () const STATICLIB_NOEXCEPT
 Size accessor.
std::streamsize size_signed () const STATICLIB_NOEXCEPT
 Size accessor.
int size_int () const STATICLIB_NOEXCEPT
 Size accessor.
size_t size_bytes () const STATICLIB_NOEXCEPT
 Size in bytes accessor.
T * begin () const STATICLIB_NOEXCEPT
 Begin iterator.
T * end () const STATICLIB_NOEXCEPT
 End iterator.

Detailed Description

template<typename T>
class staticlib::io::span< T >

Non-owning range of elements in contiguous memory.

Constructor & Destructor Documentation

template<typename T>
template<typename IntType >
staticlib::io::span< T >::span ( T *  buffer,
IntType  length 
)
inline

Constructor.

Parameters
bufferspan start pointer
lengthnumber of elements
Exceptions
bad_span_access_exceptionon null pointer or on invalid index
template<typename T>
template<typename Convertible , size_t Length>
staticlib::io::span< T >::span ( std::array< Convertible, Length > &  buffer)
inline

Constructor from array.

Parameters
bufferarray of type convertible into T
template<typename T>
staticlib::io::span< T >::span ( std::vector< T > &  buffer)
inline

Constructor from vector.

Parameters
buffervector of type T
template<typename T>
template<typename Convertible >
staticlib::io::span< T >::span ( std::vector< Convertible > &  buffer)
inline

Constructor from vector.

Parameters
bufferarray of type convertible into T
template<typename T>
staticlib::io::span< T >::span ( std::string &  buffer)
inline

Constructor from string, for char and const charspans only.

Parameters
bufferstring
template<typename T>
staticlib::io::span< T >::span ( const std::string &  buffer)
inline

Constructor from string, for const charspans only.

Parameters
bufferstring
template<typename T>
template<size_t Size>
staticlib::io::span< T >::span ( const char(&)  buffer[Size])
inline

Constructor from string literal.

Parameters
bufferstring literal
template<typename T>
staticlib::io::span< T >::span ( const span< T > &  other)
inline

Copy constructor.

Parameters
otherother span

Member Function Documentation

template<typename T>
T* staticlib::io::span< T >::begin ( ) const
inline

Begin iterator.

Returns
begin iterator
template<typename T>
T* staticlib::io::span< T >::data ( ) const
inline

Data accessor.

Returns
pointer to span start
template<typename T>
bool staticlib::io::span< T >::empty ( ) const
inline

Emptiness check.

Returns
true, if this span empty, false otherwise
template<typename T>
T* staticlib::io::span< T >::end ( ) const
inline

End iterator.

Returns
end iterator
template<typename T>
bool staticlib::io::span< T >::is_empty ( ) const
inline

Emptiness check.

Returns
true, if this span empty, false otherwise
template<typename T>
bool staticlib::io::span< T >::is_null ( ) const
inline

NULL check.

Returns
true, if this span contains NULL buffer, false otherwise
template<typename T>
span<T>& staticlib::io::span< T >::operator= ( const span< T > &  other)
inline

Copy assignment operator.

Parameters
otherother span
template<typename T>
T& staticlib::io::span< T >::operator[] ( size_t  index) const
inline

Element access checked operation.

Parameters
indexindex to access element at
Returns
reference to element
Exceptions
bad_span_access_exceptionon invalid index
template<typename T>
size_t staticlib::io::span< T >::size ( ) const
inline

Size accessor.

Returns
span size
template<typename T>
size_t staticlib::io::span< T >::size_bytes ( ) const
inline

Size in bytes accessor.

Returns
size in bytes
template<typename T>
int staticlib::io::span< T >::size_int ( ) const
inline

Size accessor.

Returns
span size as int
template<typename T>
std::streamsize staticlib::io::span< T >::size_signed ( ) const
inline

Size accessor.

Returns
span size as signed

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