µSer
uSer::Hook::SerPre< Ref > Struct Template Reference

Attribute: Define a function to be called before the object (which can but need not be a struct member) is serialized. More...

#include <uSer.hh>

Detailed Description

template<auto Ref>
struct uSer::Hook::SerPre< Ref >

Attribute: Define a function to be called before the object (which can but need not be a struct member) is serialized.

The function can be:

  1. A non-static constant member function of the surrounding struct
  2. A free function (=function pointer)
  3. A static member function of any class (=function pointer)
  4. A pointer to a global object that has operator () overloaded
  5. If the annotated object is a struct, and the annotation is not given as a member annotation of a surrounding struct, the reference may be a non-static constant member function of that struct.

The return type can be:

  1. void, in which case the function may indicate errors via exceptions, but not fail otherwise
  2. uSer_ErrorCode, in which case the function may indicate errors by the returned value or via exceptions (if enabled). If the function indicates an error via a return value and exceptions are enabled, uSer will throw an exception that forwards the error code.

A constant reference to the annotated object is passed as the first argument. For cases 2-4, a constant reference to the struct is passed as a second argument, if the attribute was applied to a struct member.


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