alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::Alignment< T_byte > Struct Template Reference

Strongly typed and constexpr representation of a byte-alignment of memory. More...

#include <Alignment.hpp>

Static Public Member Functions

template<typename T_Type>
static consteval uint32_t get ()
 Get the byte-alignment of a given type when using this alignment.

Detailed Description

template<uint32_t T_byte = std::numeric_limits<uint32_t>::max()>
struct alpaka::Alignment< T_byte >

Strongly typed and constexpr representation of a byte-alignment of memory.

The number of bytes is stored at compile-time using a value template parameter. Therefore, alignments should always be declared constexpr. If no explicit alignment is given, a default will be set.

To use the alignment, the Alignment::get() function can be called for a given type parameter, returning either the object's set alignment, or the given type's alignment, if the default was used.

Template Parameters
T_byteThe number of bytes in uint32_t.

Definition at line 25 of file Alignment.hpp.

Member Function Documentation

◆ get()

template<uint32_t T_byte = std::numeric_limits<uint32_t>::max()>
template<typename T_Type>
consteval uint32_t alpaka::Alignment< T_byte >::get ( )
inlinestaticconsteval

Get the byte-alignment of a given type when using this alignment.

Trying to use an alignment with a smaller value than the alignment of the given T_Type results in a failed static_assert.

Template Parameters
T_TypeThe type for which to get the alignment.
Returns
If T_byte is not specifically set: alignment of T_Type, else: value of T_byte

Definition at line 37 of file Alignment.hpp.


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