BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::is_shift_register_safe< T > Struct Template Reference

Type trait: may T be stored in a ShiftRegister? More...

#include <cl_ShiftRegister.hpp>

Inheritance diagram for belfem::is_shift_register_safe< T >:
[legend]
Collaboration diagram for belfem::is_shift_register_safe< T >:
[legend]

Detailed Description

template<typename T>
struct belfem::is_shift_register_safe< T >

Type trait: may T be stored in a ShiftRegister?

ShiftRegister keeps a malloc'd buffer of (capacity+1) slots. How those slots are managed depends on T:

  • Trivially copyable T (int, real, index_t, …): slots are used raw. Assignment just overwrites bytes and free() owes no destructor pass. This is the zero-overhead fast path.
  • Owning T (Vector<T>, Matrix<T>, …): the register manages element lifetime explicitly. Every slot is placement-new default-constructed when the buffer is reserved and destroyed before the buffer is freed, so all element operations (push / shift / copy / revert) act on valid, constructed objects — exactly what a non-trivial operator= expects. This requires T to be default-constructible.

Trivially copyable types qualify automatically. Owning types must be whitelisted below. Vector<T> and Matrix<T> qualify: both the Armadillo and Blaze backends have a valid default-constructed empty state, a well-behaved copy/move operator=, and a moved-from state that is a valid empty object. Do NOT whitelist a type that is not default-constructible.


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