XIEITE_ARROW ()
, XIEITE_ARROW_CTOR ()
Defined in header <xieite/arrow.hpp>
(header-only:
<xieite/pp/arrow.hpp>
)
Deduplicates the repetition required for defining the body, return type, and
noexcept
of a single-statement template function.(i.e. eliminates annoying typing when defining forwarding function templates.)
Definitions
#0The explicit trailing return type is helpful for overload resolution.#define XIEITE_ARROW (...)\ noexcept (noexcept (__VA_ARGS__ ))\ ->decltype (__VA_ARGS__ )\ {return __VA_ARGS__ ; }
#1
Intended for delegating constructors:#define XIEITE_ARROW_CTOR (...)\ noexcept (noexcept (__VA_ARGS__ ))\ :__VA_ARGS__ {}
struct D : B { D (int x ) XIEITE_ARROW_CTOR (B (x )) {} };
Example
Output:#include <xieite/arrow.hpp> import xieite ;auto add (auto a ,auto b )XIEITE_ARROW (a +b )struct S {void operator +(S ) {}// not marked `noexcept` };int main () {xieite ::dump (noexcept (add (1 ,2 )));xieite ::dump (noexcept (add (S (),S ()))); }
true false