LibSWOC++ 1.5.14
Solid Wall of C++
Loading...
Searching...
No Matches
swoc::detail::is_span_compatible< T, U > Struct Template Reference

#include <MemSpan.h>

Collaboration diagram for swoc::detail::is_span_compatible< T, U >:
Collaboration graph

Static Public Member Functions

static size_t count (size_t size)
 

Static Public Attributes

static constexpr bool value
 true if the size of T is an integral multiple of the size of U or vice versa.
 

Detailed Description

template<typename T, typename U>
struct swoc::detail::is_span_compatible< T, U >

Meta Function to check the type compatibility of two spans..

Template Parameters
TSource span type.
UDestination span type.

The types are compatible if one is an integral multiple of the other, so the span divides evenly.

U must not lose constancy compared to T.

Definition at line 903 of file MemSpan.h.

Member Function Documentation

◆ count()

template<typename T, typename U>
size_t swoc::detail::is_span_compatible< T, U >::count ( size_t size)
static

Compute the new size in units of sizeof(U).

Parameters
sizeSize in bytes.
Returns
Size in units of sizeof(U).

The critical part of this is the static_assert that guarantees the result is an integral number of instances of U.

Definition at line 920 of file MemSpan.h.

Member Data Documentation

◆ value

template<typename T, typename U>
bool swoc::detail::is_span_compatible< T, U >::value
staticconstexpr
Initial value:
= (std::ratio<sizeof(T), sizeof(U)>::num == 1 || std::ratio<sizeof(U), sizeof(T)>::num == 1) &&
(std::is_const_v<U> || !std::is_const_v<T>)

true if the size of T is an integral multiple of the size of U or vice versa.

Definition at line 905 of file MemSpan.h.


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