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

Non owning container for flat forward list. More...

#include <iffl_list.h>

Public Types

using value_type = T
 Element value type.
 
using pointer = T *
 Pointer to element type.
 
using const_pointer = T const *
 Pointer to const element type.
 
using reference = T &
 Reference to the element type.
 
using const_reference = T const &
 Reference to the const element type.
 
using size_type = std::size_t
 Size type.
 
using difference_type = std::ptrdiff_t
 Element pointers difference type.
 
using traits = TT
 Element traits type.
 
using traits_traits = flat_forward_list_traits_traits< T, TT >
 Element traits-traits type.
 
using range_t = typename traits_traits::range_t
 Vocabulary type used to describe buffer used by the element and how much of this buffer is used by the data. Type also includes information about required alignment.
 
using size_with_padding_t = typename traits_traits::size_with_padding_t
 Vocabulary type used to describe size with padding.
 
using offset_with_aligment_t = typename traits_traits::offset_with_aligment_t
 Vocabulary type used to describe size with alignment.
 
using sizes_t = flat_forward_list_sizes< traits_traits::alignment >
 Vocabulary type that contains information about buffer size, and last element range.
 
using buffer_value_type = std::conditional_t< std::is_const_v< T >, char const, char >
 Depending if T is const we will use const or non-const buffer pointer. More...
 
using const_buffer_value_type = buffer_value_type const
 When we do not intend to modify buffer we can treat it as a bag of const characters.
 
using buffer_pointer = buffer_value_type *
 Type used as a buffer pointer.
 
using const_buffer_pointer = const_buffer_value_type *
 Type used as a pointer not the const buffer.
 
using iterator = flat_forward_list_iterator< T, TT >
 Type of iterator.
 
using const_iterator = flat_forward_list_const_iterator< T, TT >
 Type of const iterator.
 
using buffer_type = buffer_t< buffer_value_type >
 Pointers that describe buffer. More...
 

Public Member Functions

 flat_forward_list_ref () noexcept
 Default constructor.
 
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
 flat_forward_list_ref (flat_forward_list_ref< V, VV > const &other) noexcept
 Assignment operator to view from a ref. More...
 
 flat_forward_list_ref (buffer_type const &other_buff) noexcept
 Constructor that initializes view to point to the buffer. More...
 
 flat_forward_list_ref (buffer_pointer buffer_begin, buffer_pointer last_element, buffer_pointer buffer_end) noexcept
 Constructor that copies list from a buffer. More...
 
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
 flat_forward_list_ref (flat_forward_list_iterator< V, VV > const &begin, flat_forward_list_iterator< V, VV > const &last) noexcept
 Constructor that creates a view over a buffer described by a pair of iterators. More...
 
 flat_forward_list_ref (buffer_pointer *buffer, size_t buffer_size) noexcept
 Constructor that checks if buffer contains a valid list and if it does then copies that list. More...
 
template<typename V , typename VV , typename A , typename UNUSED = std::enable_if<std::is_assignable_v<T*, V*>>>
 flat_forward_list_ref (flat_forward_list< V, VV, A > const &c) noexcept
 Constructs view from container. More...
 
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
flat_forward_list_refoperator= (flat_forward_list_ref< V, VV > const &other)
 Copy assignment operator. More...
 
flat_forward_list_refoperator= (buffer_view const &other_buffer)
 Copy assignment operator. More...
 
template<typename V , typename VV , typename A , typename UNUSED = std::enable_if<std::is_assignable_v<T*, V*>>>
flat_forward_list_refoperator= (flat_forward_list< V, VV, A > const &c) noexcept
 Constructs view from container. More...
 
 ~flat_forward_list_ref () noexcept
 Destructor. More...
 
void assign (buffer_type const &other_buff) noexcept
 Assigns view to point to the described buffer. More...
 
void assign (buffer_pointer buffer_begin, buffer_pointer last_element, buffer_pointer buffer_end) noexcept
 Assigns view to point to the described buffer. More...
 
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
void assign (flat_forward_list_iterator< V, VV > const &begin, flat_forward_list_iterator< V, VV > const &last) noexcept
 Assigns view to point to the described buffer. More...
 
void assign (buffer_pointer *buffer, size_t buffer_size) noexcept
 Assigns view to point to the described buffer. More...
 
void swap (flat_forward_list_ref &other) noexcept
 Swaps content of this container and the other container. More...
 
T & front ()
 
T const & front () const
 
T & back ()
 
T const & back () const
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator last () noexcept
 
const_iterator last () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator clast () const noexcept
 
const_iterator cend () const noexcept
 
char * data () noexcept
 
char const * data () const noexcept
 
bool revalidate_data () noexcept
 Validates that buffer contains a valid list. More...
 
size_type required_size (const_iterator const &it) const noexcept
 Returns capacity used by the element's data. More...
 
size_type used_size (const_iterator const &it) const noexcept
 
range_t range (const_iterator const &it) const noexcept
 Information about the buffer occupied by an element. More...
 
range_t closed_range (const_iterator const &begin, const_iterator const &last) const noexcept
 Information about the buffer occupied by elements in the range [begin, last]. More...
 
range_t half_open_range (const_iterator const &begin, const_iterator const &end) const noexcept
 Information about the buffer occupied by elements in the range [begin, end). More...
 
bool contains (const_iterator const &it, size_type position) const noexcept
 Tells if given offset in the buffer falls into a buffer used by the element. More...
 
const_iterator find_element_before (size_type position) const noexcept
 Searches for an element before the element that contains given position. More...
 
const_iterator find_element_at (size_type position) const noexcept
 Searches for an element that contains given position. More...
 
const_iterator find_element_after (size_type position) const noexcept
 Searches for an element after the element that contains given position. More...
 
size_type size () const noexcept
 Number of elements in the container. More...
 
bool empty () const noexcept
 Tells if container contains no elements. More...
 
 operator bool () const
 
size_type used_capacity () const noexcept
 
size_type total_capacity () const noexcept
 
size_type remaining_capacity () const noexcept
 
template<typename V , typename VV , typename A , typename UNUSED >
flat_forward_list_ref< T, TT > & operator= (flat_forward_list< V, VV, A > const &c) noexcept
 Constructs ref or view from container. More...
 

Static Public Attributes

static bool const is_ref { !std::is_const_v<T> }
 True if this is a ref and false if this is a view.
 
static size_type const npos = iffl::npos
 Constant that represents and invalid or non-existent position.
 

Detailed Description

template<typename T, typename TT = flat_forward_list_traits<T>>
class iffl::flat_forward_list_ref< T, TT >

Non owning container for flat forward list.

Forward declaration of intrusive flat forward list reference.

Template Parameters
T- element type
TT- element type traits Provides helpers accessing elements of the buffer without taking ownership of the buffer.

Member Typedef Documentation

◆ buffer_type

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::buffer_type

Pointers that describe buffer.

Depending if T is const buffer uses char * or char const *

◆ buffer_value_type

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::buffer_value_type

Depending if T is const we will use const or non-const buffer pointer.

Since we have variable size elements, and we cannot express it in the C++ type system we treat buffer with elements as a bag of chars and cast to the element type when necessary.

Constructor & Destructor Documentation

◆ flat_forward_list_ref() [1/6]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( flat_forward_list_ref< V, VV > const &  other)
inlinenoexcept

Assignment operator to view from a ref.

Template Parameters
V- For SFINAE we need to make this method a template Type const iterator is pointing to.
VV- Type traits.

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

◆ flat_forward_list_ref() [2/6]

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( buffer_type const &  other_buff)
inlineexplicitnoexcept

Constructor that initializes view to point to the buffer.

Parameters
other_buff- pointer to the start of the buffer that contains list.

This constructor does not validate if this is a valid flat forward list. It assumes that caller validated buffer before using this constructor.

◆ flat_forward_list_ref() [3/6]

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( buffer_pointer  buffer_begin,
buffer_pointer  last_element,
buffer_pointer  buffer_end 
)
inlinenoexcept

Constructor that copies list from a buffer.

Parameters
buffer_begin- pointer to the start of the buffer that contains list.
buffer_end- pointer to the address right after last byte in the buffer.
last_element- pointers to the last element of the list in the buffer. If buffer does not contain any elements then this parameter must be nullptr.

This constructor does not validate if this is a valid flat forward list. It assumes that caller validated buffer before using this constructor.

◆ flat_forward_list_ref() [4/6]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( flat_forward_list_iterator< V, VV > const &  begin,
flat_forward_list_iterator< V, VV > const &  last 
)
inlinenoexcept

Constructor that creates a view over a buffer described by a pair of iterators.

Template Parameters
V- For SFINAE we need to make this method a template Type const iterator is pointing to.
VV- Type traits.
Parameters
begin- iterator for the buffer begin.
last- last element that should be included in the view

This constructor does not validate if this is a valid flat forward list. It assumes that caller validated buffer before using this constructor.

◆ flat_forward_list_ref() [5/6]

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( buffer_pointer buffer,
size_t  buffer_size 
)
inlinenoexcept

Constructor that checks if buffer contains a valid list and if it does then copies that list.

Parameters
buffer- pointer to the start of the buffer that might contains list.
buffer_size- buffer size.

This constructor searches for the last valid element in the buffer, and is buffer is valid then it copies elements to the new buffer.

◆ flat_forward_list_ref() [6/6]

template<typename T , typename TT >
template<typename V , typename VV , typename A , typename UNUSED >
iffl::flat_forward_list_ref< T, TT >::flat_forward_list_ref ( flat_forward_list< V, VV, A > const &  c)
explicitnoexcept

Constructs view from container.

Constructs ref or view from container.

Template Parameters
V- For SFINAE we need to make this method a template Type const iterator is pointing to.
VV- Type traits.
A- allocator type
Parameters
c- container we are constructing view from
Template Parameters
T- element type
TT- element type traits
A- allocator type

◆ ~flat_forward_list_ref()

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::~flat_forward_list_ref ( )
inlinenoexcept

Destructor.

Deallocates buffer owned by container.

Member Function Documentation

◆ assign() [1/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
void iffl::flat_forward_list_ref< T, TT >::assign ( buffer_type const &  other_buff)
inlinenoexcept

Assigns view to point to the described buffer.

Parameters
other_buff- pointer to the start of the buffer that contains list.

This method does not validate if this is a valid flat forward list. It assumes that caller validated buffer before using this constructor.

◆ assign() [2/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
void iffl::flat_forward_list_ref< T, TT >::assign ( buffer_pointer  buffer_begin,
buffer_pointer  last_element,
buffer_pointer  buffer_end 
)
inlinenoexcept

Assigns view to point to the described buffer.

Parameters
buffer_begin- pointer to the start of the buffer that contains list.
last_element- pointer to the last element of the list.
buffer_end- pointer to the end of the buffer.

This method does not validate if this is a valid flat forward list. It assumes that caller validated buffer before using this constructor.

◆ assign() [3/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
void iffl::flat_forward_list_ref< T, TT >::assign ( flat_forward_list_iterator< V, VV > const &  begin,
flat_forward_list_iterator< V, VV > const &  last 
)
inlinenoexcept

Assigns view to point to the described buffer.

Template Parameters
V- For SFINAE we need to make this method a template Type const iterator is pointing to.
VV- Type traits.
Parameters
begin- iterator for the buffer begin.
last- last element that should be included in the view

◆ assign() [4/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
void iffl::flat_forward_list_ref< T, TT >::assign ( buffer_pointer buffer,
size_t  buffer_size 
)
inlinenoexcept

Assigns view to point to the described buffer.

Parameters
buffer- pointer to the begin of a buffer.
buffer_size- size of the buffer.

◆ back() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
T& iffl::flat_forward_list_ref< T, TT >::back ( )
inline
Returns
Returns a reference to the last element in the container.

Calling this method on a empty container will trigger fail-fast

◆ back() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
T const& iffl::flat_forward_list_ref< T, TT >::back ( ) const
inline
Returns
Returns a const reference to the last element in the container.

Calling this method on a empty container will trigger fail-fast

◆ begin() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
iterator iffl::flat_forward_list_ref< T, TT >::begin ( )
inlinenoexcept
Returns
Returns an iterator pointing to the first element of container.

Calling on an empty container returns end iterator

◆ begin() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::begin ( ) const
inlinenoexcept
Returns
Returns a const iterator pointing to the first element of container.

Calling on an empty container returns const end iterator

◆ cbegin()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::cbegin ( ) const
inlinenoexcept
Returns
Returns a const iterator pointing to the first element of container.

Calling on an empty container returns const end iterator

◆ cend()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::cend ( ) const
inlinenoexcept
Returns
Returns an end const_iterator.

For types that support get_next_offset offset or when container is empty, the end iterator is const_iterator{}. For types that do not support get_next_offset an end iterator is pointing pass the last element of container

◆ clast()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::clast ( ) const
inlinenoexcept
Returns
Returns a const iterator pointing to the last element of container.

Calling on an empty container returns end iterator

◆ closed_range()

template<typename T, typename TT = flat_forward_list_traits<T>>
range_t iffl::flat_forward_list_ref< T, TT >::closed_range ( const_iterator const &  begin,
const_iterator const &  last 
) const
inlinenoexcept

Information about the buffer occupied by elements in the range [begin, last].

Parameters
begin- iterator pointing to the first element.
last- iterator pointing to the last element in the range.
Returns
For any case, except when last element of range is last element of the collection, it returns:
  • start of the first element.
  • offset of the last element data end.
  • offset of the last element buffer end. If range last is last element of collection then data end and buffer end point to the same position.

All offsets values are relative to the buffer owned by the container.

◆ contains()

template<typename T, typename TT = flat_forward_list_traits<T>>
bool iffl::flat_forward_list_ref< T, TT >::contains ( const_iterator const &  it,
size_type  position 
) const
inlinenoexcept

Tells if given offset in the buffer falls into a buffer used by the element.

Parameters
it- iterator pointing to an element
position- offset in the container's buffer.
Returns
True if position is in the element's buffer. and false otherwise. Element's buffer is retrieved using range(it). When iterator refers to container end or when position is npos the result will be false.

◆ data() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
char* iffl::flat_forward_list_ref< T, TT >::data ( )
inlinenoexcept
Returns
Pointer to the begging of the buffer or nullptr container has if no allocated buffer.

◆ data() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
char const* iffl::flat_forward_list_ref< T, TT >::data ( ) const
inlinenoexcept
Returns
Const pointer to the begging of the buffer or nullptr container has if no allocated buffer.

◆ empty()

template<typename T, typename TT = flat_forward_list_traits<T>>
bool iffl::flat_forward_list_ref< T, TT >::empty ( ) const
inlinenoexcept

Tells if container contains no elements.

Returns
False when container contains at least one element and true otherwise.

Both container with no buffer as well as container that has buffer that does not contain any valid elements will return true.

◆ end() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
iterator iffl::flat_forward_list_ref< T, TT >::end ( )
inlinenoexcept
Returns
Returns an end iterator.

An end iterator is pointing pass the last element of container. View might be pointing in a middle of a flat forward list so our last element might be not a last element of list. It is arbitrary what we are using as a pointer to the last element, as long as we are using it consistently. This implementation uses

  • If next_offset is not 0 then location of next element in the list pass the view. This iterator is also a valid non-end iterator of container.
  • In all other cases pointer to the buffer pass the end of last element

◆ end() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::end ( ) const
inlinenoexcept
Returns
Returns an end const_iterator.

An end iterator is pointing pass the last element of container View might be pointing in a middle of a flat forward list so our last element might be not a last element of list. It is arbitrary what we are using as a pointer to the last element, as long as we are using it consistently. This implementation uses

  • If next_offset is not 0 then location of next element in the list pass the view. This iterator is also a valid non-end iterator of container.
  • In all other cases pointer to the buffer pass the end of last element

◆ find_element_after()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::find_element_after ( size_type  position) const
inlinenoexcept

Searches for an element after the element that contains given position.

Parameters
position- offset in the container's buffer
Returns
Const iterator to the found element, if it was found, and container's end const iterator otherwise.

Cost of this algorithm is O(number of elements in container) because we have to performs linear search for an element from the start of container's buffer.

◆ find_element_at()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::find_element_at ( size_type  position) const
inlinenoexcept

Searches for an element that contains given position.

Parameters
position- offset in the container's buffer
Returns
Const iterator to the found element, if it was found, and container's end const iterator otherwise.

Cost of this algorithm is O(number of elements in container) because we have to performs linear search for an element from the start of container's buffer.

◆ find_element_before()

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::find_element_before ( size_type  position) const
inlinenoexcept

Searches for an element before the element that contains given position.

Parameters
position- offset in the container's buffer
Returns
Const iterator to the found element, if it was found, and container's end const iterator otherwise.

Cost of this algorithm is O(number of elements in container) because we have to performs linear search for an element from the start of container's buffer.

◆ front() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
T& iffl::flat_forward_list_ref< T, TT >::front ( )
inline
Returns
Returns a reference to the first element in the container.

Calling this method on a empty container will trigger fail-fast

◆ front() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
T const& iffl::flat_forward_list_ref< T, TT >::front ( ) const
inline
Returns
Returns a const reference to the first element in the container.

Calling this method on a empty container will trigger fail-fast

◆ half_open_range()

template<typename T, typename TT = flat_forward_list_traits<T>>
range_t iffl::flat_forward_list_ref< T, TT >::half_open_range ( const_iterator const &  begin,
const_iterator const &  end 
) const
inlinenoexcept

Information about the buffer occupied by elements in the range [begin, end).

Parameters
begin- iterator pointing to the first element.
end- iterator pointing to the past last element in the range.
Returns
For any case, except when end element of range is the end element of the collection,
  • start of the first element.
  • offset of the element before end data end.
  • offset of the element before end buffer end. If range end is collection end then data end and buffer end point to the same position.

All offsets values are relative to the buffer owned by the container. Algorithm has complexity O(number of elements in collection) because to find element before end we have to scan buffer from beginning.

◆ last() [1/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
iterator iffl::flat_forward_list_ref< T, TT >::last ( )
inlinenoexcept
Returns
Returns an iterator pointing to the last element of container.

Calling on an empty container returns end iterator

◆ last() [2/2]

template<typename T, typename TT = flat_forward_list_traits<T>>
const_iterator iffl::flat_forward_list_ref< T, TT >::last ( ) const
inlinenoexcept
Returns
Returns a const iterator pointing to the last element of container.

Calling on an empty container returns end iterator

◆ operator bool()

template<typename T, typename TT = flat_forward_list_traits<T>>
iffl::flat_forward_list_ref< T, TT >::operator bool ( ) const
inlineexplicit
Returns
True when container contains at least one element and false otherwise.

◆ operator=() [1/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename = std::enable_if<std::is_assignable_v<T*, V*>>>
flat_forward_list_ref& iffl::flat_forward_list_ref< T, TT >::operator= ( flat_forward_list_ref< V, VV > const &  other)
inline

Copy assignment operator.

Parameters
other- linked list we are moving from

◆ operator=() [2/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
flat_forward_list_ref& iffl::flat_forward_list_ref< T, TT >::operator= ( buffer_view const &  other_buffer)
inline

Copy assignment operator.

Parameters
other_buffer- linked list we are copying from

◆ operator=() [3/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename A , typename UNUSED = std::enable_if<std::is_assignable_v<T*, V*>>>
flat_forward_list_ref& iffl::flat_forward_list_ref< T, TT >::operator= ( flat_forward_list< V, VV, A > const &  c)
noexcept

Constructs view from container.

Template Parameters
V- For SFINAE we need to make this method a template Type const iterator is pointing to.
VV- Type traits.
A- allocator type
Parameters
c- container we are constructing view from
Returns
reference to self

◆ operator=() [4/4]

template<typename T, typename TT = flat_forward_list_traits<T>>
template<typename V , typename VV , typename A , typename UNUSED >
flat_forward_list_ref<T, TT>& iffl::flat_forward_list_ref< T, TT >::operator= ( flat_forward_list< V, VV, A > const &  c)
noexcept

Constructs ref or view from container.

Template Parameters
T- element type
TT- element type traits
A- allocator type
Returns
reference to self

◆ range()

template<typename T, typename TT = flat_forward_list_traits<T>>
range_t iffl::flat_forward_list_ref< T, TT >::range ( const_iterator const &  it) const
inlinenoexcept

Information about the buffer occupied by an element.

Parameters
it- iterator pointing to an element.
Returns
For any element except the last, it returns:
  • start element offset.
  • offset of element data end.
  • offset of element buffer end. For the last element data end and buffer end point to the same position.

All offsets values are relative to the buffer owned by the container.

◆ remaining_capacity()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::remaining_capacity ( ) const
inlinenoexcept
Returns
Number of bytes in the buffer not used by the existing elements.

◆ required_size()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::required_size ( const_iterator const &  it) const
inlinenoexcept

Returns capacity used by the element's data.

Parameters
it- iterator pointing to the element we are returning size for.
Returns
Returns size of the element without padding

◆ revalidate_data()

template<typename T, typename TT = flat_forward_list_traits<T>>
bool iffl::flat_forward_list_ref< T, TT >::revalidate_data ( )
inlinenoexcept

Validates that buffer contains a valid list.

Returns
true if valid list was found and false otherwise.

You must call this method after passing pointer to container's buffer to a function that might change buffer content. If valid list of found then buff().last will be pointing to the element that was found. If no valid list was found then buff().last will be nullptr.

◆ size()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::size ( ) const
inlinenoexcept

Number of elements in the container.

Returns
Number of elements in the container.

Cost of this algorithm is O(number of elements in container). Container does not actively cache/updates element count so we need to scan list to find number of elements.

◆ swap()

template<typename T, typename TT = flat_forward_list_traits<T>>
void iffl::flat_forward_list_ref< T, TT >::swap ( flat_forward_list_ref< T, TT > &  other)
inlinenoexcept

Swaps content of this container and the other container.

Parameters
other- reference to the other container
Exceptions
mightthrow std::bad_alloc if allocator swap throws or if allocators do not support swap, and we need to make a copy of elements, which involves allocation.

◆ total_capacity()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::total_capacity ( ) const
inlinenoexcept
Returns
Buffer size.

◆ used_capacity()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::used_capacity ( ) const
inlinenoexcept
Returns
Number of bytes in the buffer used by existing elements.

◆ used_size()

template<typename T, typename TT = flat_forward_list_traits<T>>
size_type iffl::flat_forward_list_ref< T, TT >::used_size ( const_iterator const &  it) const
inlinenoexcept
Parameters
it- iterator pointing to the element we are returning size for.
Returns
For any element except last returns distance from element start to the start of the next element. For the last element it returns used_capacity

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