iffl
1.3.4
Implements Intrusive Flat Forward List container
|
traits for flat_forward_list_traits More...
#include <iffl_list.h>
Public Types | |
using | value_type = T |
using | type_traits = TT |
using | has_minimum_size_t = iffl::mpl::is_detected< has_minimum_size_mfn, type_traits > |
Uses detect idiom with has_minimum_size_mfn to find if traits implemented minimum_size. More... | |
using | has_get_size_t = iffl::mpl::is_detected< has_get_size_mfn, type_traits > |
Uses detect idiom with has_get_size_mfn to find if traits implemented get_size. More... | |
using | has_next_offset_t = iffl::mpl::is_detected< has_next_offset_mfn, type_traits > |
Uses detect idiom with has_next_offset_mfn to find if traits implemented get_next_offset. More... | |
using | can_set_next_offset_t = iffl::mpl::is_detected< can_set_next_offset_mfn, type_traits > |
Uses detect idiom with can_set_next_offset_mfn to find if traits implemented set_next_offset. More... | |
using | can_validate_t = iffl::mpl::is_detected< can_validate_mfn, type_traits > |
Uses detect idiom with can_validate_mfn to find if traits implemented validate. More... | |
using | has_alignment_t = iffl::mpl::is_detected< has_alignment_mfn, type_traits > |
Uses detect idiom with has_alignment_mfn to find if traits implemented validate. More... | |
using | range_t = range_with_alighment< alignment > |
Specialization of range_with_alighment for this type alignment. | |
using | size_with_padding_t = size_with_padding< alignment > |
Specialization of size_with_padding for this type alignment. | |
using | offset_with_aligment_t = offset_with_aligment< alignment > |
Specialization of offset_with_aligment for this type alignment. | |
Static Public Member Functions | |
static value_type * | ptr_to_t (void *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static value_type const * | ptr_to_t (void const *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static value_type * | ptr_to_t (char *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static value_type const * | ptr_to_t (char const *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static value_type * | ptr_to_t (unsigned char *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static value_type const * | ptr_to_t (unsigned char const *ptr) |
Casts buffer pointer to a pointer to the element type. More... | |
static constexpr size_t | minimum_size () noexcept |
returns minimum valid element size | |
static constexpr size_t | get_alignment () noexcept |
If traits defined alignment then size of alignment, and 1 otherwise. | |
static constexpr size_t | roundup_to_alignment (size_t s) noexcept |
If traits defined alignment then s padded to alignment, or unchanged value of s otherwise. More... | |
static constexpr size_with_padding_t | get_size (char const *buffer) noexcept |
Asks type traits to calculate element size. More... | |
static constexpr bool | validate (size_t buffer_size, T const &buffer) noexcept |
Asks type traits to validate element. More... | |
static constexpr size_t | get_next_offset (char const *buffer) noexcept |
Returns next element offset. More... | |
static constexpr void | set_next_offset (char *buffer, size_t size) noexcept |
Sets next element offset. More... | |
static void | print_traits_info () noexcept |
Prints information about what traits_traits discovered about traits class. | |
Static Public Attributes | |
static constexpr auto const | has_minimum_size_v { iffl::mpl::is_detected_v < has_minimum_size_mfn, type_traits> } |
Instance of has_minimum_size_t. More... | |
static constexpr auto const | has_get_size_v { iffl::mpl::is_detected_v < has_get_size_mfn, type_traits> } |
Instance of has_get_size_t. More... | |
static constexpr auto const | has_next_offset_v { iffl::mpl::is_detected_v < has_next_offset_mfn, type_traits> } |
Instance of has_next_offset_t. More... | |
static constexpr auto const | can_set_next_offset_v { iffl::mpl::is_detected_v < can_set_next_offset_mfn, type_traits> } |
Instance of can_set_next_offset_t. More... | |
static constexpr auto const | can_validate_v { iffl::mpl::is_detected_v < can_validate_mfn, type_traits> } |
Instance of can_validate_t. More... | |
static constexpr auto const | has_alignment_v { iffl::mpl::is_detected_v < has_alignment_mfn, type_traits> } |
Instance of has_alignment_t. More... | |
static constexpr size_t const | alignment { get_alignment() } |
Defines static constexpr member that with value that has alignment requirements of elements. | |
traits for flat_forward_list_traits
T | - element header type |
TT | - type traits |
I know, traits of traits does sounds ridicules, but this is exactly what this class is. Given flat_forward_list_traits instantiation, or a class that you want to use as traits for your flat_forward_list element types, it detects what methods are implemented by this trait so in the rest of algorithms and containers we can use this helper, and avoid rewriting same complicated and nasty machinery. In other words traits might be missing some methods, and traits_traits will implement these missing parts providing a uniform interface.
How to use:
For example:
If traits provide us a way to get value of the next element offset for a type then use it, otherwise ask it to calculate next element offset from its own size If traits provides alignment member then we will use in calculation of padding, otherwise calculations of padding will use 1 byte alignment.
iffl::flat_forward_list_traits_traits< T, TT >::can_set_next_offset_t |
Uses detect idiom with can_set_next_offset_mfn to find if traits implemented set_next_offset.
If traits have get_next_offset then can_set_next_offset_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::can_validate_t |
Uses detect idiom with can_validate_mfn to find if traits implemented validate.
If traits have get_next_offset then can_validate_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::has_alignment_t |
Uses detect idiom with has_alignment_mfn to find if traits implemented validate.
If traits have traits::alignment static variable then has_alignment_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::has_get_size_t |
Uses detect idiom with has_get_size_mfn to find if traits implemented get_size.
If traits have get_size then has_get_size_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::has_minimum_size_t |
Uses detect idiom with has_minimum_size_mfn to find if traits implemented minimum_size.
If traits have minimum_size then has_minimum_size_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::has_next_offset_t |
Uses detect idiom with has_next_offset_mfn to find if traits implemented get_next_offset.
If traits have get_next_offset then has_next_offset_t is std::true_type otherwise std::false_type
iffl::flat_forward_list_traits_traits< T, TT >::type_traits |
!brief alias for the traits
iffl::flat_forward_list_traits_traits< T, TT >::value_type |
!brief alias for the value type
|
inlinestaticnoexcept |
Returns next element offset.
buffer | - pointer to the beginning of the element |
|
inlinestaticnoexcept |
Asks type traits to calculate element size.
buffer | - pointer to the beginning of the element |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestatic |
Casts buffer pointer to a pointer to the element type.
ptr | - pointer to a buffer |
|
inlinestaticnoexcept |
If traits defined alignment then s padded to alignment, or unchanged value of s otherwise.
s | - value that we are rounding up |
|
inlinestaticnoexcept |
Sets next element offset.
Types that support setting next element offset must also support get_next_offset.
buffer | - pointer to the beginning of the element |
size | - offset of the next element |
|
inlinestaticnoexcept |
Asks type traits to validate element.
If traits do not have validate method
buffer_size | - size of the buffer used by this element |
buffer | - pointer to the beginning of the element |
|
static |
Instance of can_set_next_offset_t.
can_set_next_offset_v is std::true_type{} otherwise std::false_type{}
|
static |
Instance of can_validate_t.
can_validate_v is std::true_type{} otherwise std::false_type{}
|
static |
Instance of has_alignment_t.
has_alignment_v is std::true_type{} otherwise std::false_type{}
|
static |
Instance of has_get_size_t.
has_get_size_v is std::true_type{} otherwise std::false_type{}
|
static |
Instance of has_minimum_size_t.
has_minimum_size_v is std::true_type{} otherwise std::false_type{}
|
static |
Instance of has_next_offset_t.
has_next_offset_v is std::true_type{} otherwise std::false_type{}