Prologue and Epilogue

Every source in hysj starts by including the prologue, and ends by including the epilogue. These introduce and unintroduce some unhygenic, but ergonomic, macros. The macros are cleaned up in the epilogue.

Example

#include<yada.hpp>

#include<hysj/detail/prologue.hpp>
namespace hysj::inline _HYSJ_VERSION_NAMESPACE::something{
  //yada yada.
}
#include<hysj/detail/epilogue.hpp>

Prologue

#include<hysj/detail/prologue.hpp>

fwd(expression)

Simpler std::forward.


arrow(sequence)

Expects a sequence of (expression)(constraint), where constraint is optional.

Sets up noexcept-specification, trailing return type deduction, and a function body, repating expression 3 times. If constraint is supplied it will be pasted as a return-type-requirement on expression.

Example

Defines a function:

constexpr add_one(auto x)
  arrow((x + 1)(-> std::integral))

equivalent to:

constexpr add_one(auto x) noexcept(noexcept(x+1))
  -> decltype(auto)
  requires requires { { x + 1 } -> std::integral; }
{ return x + 1; }

lift(identifier)

Lifts identifier into a variadic lambda using arrow.

Example

Invokes a range of callables:

std::ranges::for_each(callables,lift(std::invoke));

reify(expression)

Extracts the nested type-alias type from the uncvref’d type of the expression.

Example

Computes type from identity_type expression:

static_assert(std::is_same_v<reify(std::identity_type<int>{}),int>);

Epilogue

#include<hysj/detail/epilogue.hpp>

Undefines the unhygenic, non-namespace-prefixed, macros introduced in the prologue.