iffl  1.3.4
Implements Intrusive Flat Forward List container
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
iffl::buffer_t< T > Class Template Reference

A set of pointers describing state of the buffer containing flat forward list. More...

#include <iffl_common.h>

Public Types

using value_type = T
 type of buffer elements
 
using pointer_type = T *
 Pinter to the buffer elements.
 
using refernce_type = T &
 Reference to the buffer elements.
 
using size_type = size_t
 Size type.
 

Public Member Functions

 buffer_t ()=default
 Default constructor.
 
 buffer_t (buffer_t const &)=default
 Copy constructor.
 
buffer_toperator= (buffer_t const &)=default
 Copy assignment operator.
 
template<typename V , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
 buffer_t (buffer_t< V > const &buff)
 Constructors const buffer from non-const buffer. More...
 
template<typename V , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
buffer_toperator= (buffer_t< V > const &buff)
 Assignment operator to const buffer from non-const buffer. More...
 
 buffer_t (T *begin, T *last, T *end) noexcept
 Assignment operator to const buffer from pointers.
 
 buffer_t (T *begin, size_t *last_offset, T *end_offset) noexcept
 Assignment operator to const buffer from pointers.
 
constexpr void set_begin (pointer_type new_begin) noexcept
 Sets pointer to the buffer begin and recalculates last and end. More...
 
constexpr size_type size () const noexcept
 
constexpr void set_size_unsafe (size_type size) noexcept
 Updates buffer size. More...
 
constexpr void set_size (size_type size) noexcept
 Updates buffer size. More...
 
constexpr size_type last_offset () const noexcept
 
constexpr void set_last_offset_unsafe (size_type offset) noexcept
 Sets offset of the last pointer. More...
 
constexpr void set_last_offset (size_type offset) noexcept
 Sets offset of the last pointer. More...
 
constexpr void validate () const noexcept
 Fail fast is invariants are broken.
 
constexpr void clear () noexcept
 Resets all pointers to nullptr.
 
constexpr void forget_last () noexcept
 Sets pointer to last element to nullptr.
 
constexpr operator bool () const noexcept
 

Public Attributes

pointer_type begin { nullptr }
 Pointer to the beginning of buffer nullptr if no buffer.
 
pointer_type last { nullptr }
 Pointer to the last element in the list nullptr if no buffer or if there is no elements in the list.
 
pointer_type end { nullptr }
 Pointer to the end of buffer nullptr if no buffer.
 

Static Public Attributes

static bool const is_const { std::is_same_v<T, char const> }
 True if this is const buffer and false otherwise.
 

Detailed Description

template<typename T = char>
class iffl::buffer_t< T >

A set of pointers describing state of the buffer containing flat forward list.

Constructor & Destructor Documentation

◆ buffer_t()

template<typename T = char>
template<typename V , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
iffl::buffer_t< T >::buffer_t ( buffer_t< V > const &  buff)
inline

Constructors const buffer from non-const buffer.

Use SFINAE to enable it only on const instantiation to support assignment from a non-const instantiation of template

Member Function Documentation

◆ last_offset()

template<typename T = char>
constexpr size_type iffl::buffer_t< T >::last_offset ( ) const
inlinenoexcept
Returns
Returns offset of the last element in the buffer

◆ operator bool()

template<typename T = char>
constexpr iffl::buffer_t< T >::operator bool ( ) const
inlineexplicitnoexcept
Returns
True if begin is pointing to nullptr and true otherwise

◆ operator=()

template<typename T = char>
template<typename V , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
buffer_t& iffl::buffer_t< T >::operator= ( buffer_t< V > const &  buff)
inline

Assignment operator to const buffer from non-const buffer.

Use SFINAE to enable it only on const instantiation to support assignment from a non-const instantiation of template

◆ set_begin()

template<typename T = char>
constexpr void iffl::buffer_t< T >::set_begin ( pointer_type  new_begin)
inlinenoexcept

Sets pointer to the buffer begin and recalculates last and end.

Parameters
new_begin- pointer to the buffer begin

◆ set_last_offset()

template<typename T = char>
constexpr void iffl::buffer_t< T >::set_last_offset ( size_type  offset)
inlinenoexcept

Sets offset of the last pointer.

Parameters
offset- offset of the last element in the buffer

◆ set_last_offset_unsafe()

template<typename T = char>
constexpr void iffl::buffer_t< T >::set_last_offset_unsafe ( size_type  offset)
inlinenoexcept

Sets offset of the last pointer.

Parameters
offset- offset of the last element in the buffer

◆ set_size()

template<typename T = char>
constexpr void iffl::buffer_t< T >::set_size ( size_type  size)
inlinenoexcept

Updates buffer size.

Parameters
size- size of the buffer

◆ set_size_unsafe()

template<typename T = char>
constexpr void iffl::buffer_t< T >::set_size_unsafe ( size_type  size)
inlinenoexcept

Updates buffer size.

Parameters
size- size of the buffer

◆ size()

template<typename T = char>
constexpr size_type iffl::buffer_t< T >::size ( ) const
inlinenoexcept
Returns
Returns buffer size

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