mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
mal_toolkit::_template_detail Namespace Reference

Classes

struct  function_traits
 Traits for extracting information from a function type. More...
 
struct  function_traits< std::function< Ret(Args...)> >
 Traits for extracting information from a function type. More...
 
struct  index_of_function_arg
 Helper for calculating the index of a type within a function's argument list. More...
 
struct  index_of_function_arg< std::function< Ret(Args...)> >
 Helper for calculating the index of a type within a function's argument list. More...
 

Functions

template<typename A >
constexpr size_t CalculateSize ()
 Calculates the total size of multiple types in bytes.
 
template<typename A , typename B , typename... Args>
constexpr size_t CalculateSize ()
 Calculates the total size of multiple types in bytes.
 
template<typename T >
consteval size_t index_of_helper (std::size_t)
 Calculates the index of a type within a parameter pack.
 
template<typename T , typename U >
consteval size_t index_of_helper (std::size_t index)
 Calculates the index of a type within a parameter pack.
 
template<typename T , typename U , typename V , typename... Rest>
consteval size_t index_of_helper (std::size_t index)
 Calculates the index of a type within a parameter pack.
 

Function Documentation

◆ CalculateSize() [1/2]

template<typename A >
size_t mal_toolkit::_template_detail::CalculateSize ( )
constexpr

Calculates the total size of multiple types in bytes.

Template Parameters
AThe type whose size is to be calculated.
Returns
The size of the type A in bytes.

Definition at line 17 of file template.hpp.

Here is the caller graph for this function:

◆ CalculateSize() [2/2]

template<typename A , typename B , typename... Args>
size_t mal_toolkit::_template_detail::CalculateSize ( )
constexpr

Calculates the total size of multiple types in bytes.

Template Parameters
AThe first type whose size is to be calculated.
BThe second type whose size is to be calculated.
ArgsThe remaining types whose sizes are to be calculated.
Returns
The sum of sizes of all specified types in bytes.

Definition at line 30 of file template.hpp.

Here is the call graph for this function:

◆ index_of_helper() [1/3]

template<typename T , typename U >
size_t mal_toolkit::_template_detail::index_of_helper ( std::size_t index)
consteval

Calculates the index of a type within a parameter pack.

Template Parameters
TThe type to search for.
UThe current type being checked.
Parameters
indexThe current index being checked.
Returns
The index of type T if found, otherwise continues to the next type.

Definition at line 55 of file template.hpp.

Here is the call graph for this function:

◆ index_of_helper() [2/3]

template<typename T , typename U , typename V , typename... Rest>
size_t mal_toolkit::_template_detail::index_of_helper ( std::size_t index)
consteval

Calculates the index of a type within a parameter pack.

Template Parameters
TThe type to search for.
UThe current type being checked.
VThe next type to check.
RestThe remaining types to check.
Parameters
indexThe current index being checked.
Returns
The index of type T if found, otherwise continues to the next type.

Definition at line 74 of file template.hpp.

Here is the call graph for this function:

◆ index_of_helper() [3/3]

template<typename T >
size_t mal_toolkit::_template_detail::index_of_helper ( std::size_t )
consteval

Calculates the index of a type within a parameter pack.

Template Parameters
TThe type to search for.
Parameters
indexThe current index being checked.
Returns
The index of type T if found, otherwise std::numeric_limits<std::size_t>::max().

Definition at line 42 of file template.hpp.

Here is the caller graph for this function: