一呼百應, "one call, a hundred responses"
Loading...
Searching...
No Matches
Object Lifetimes
Collaboration diagram for Object Lifetimes:

Macros

#define ein_lifetimebound
 [[lifetimebound]]
 
#define ein_noescape
 portable __attribute__((noescape))
 
#define ein_nodiscard   [[nodiscard]]
 C++17 [[nodiscard]].
 

Detailed Description

Macro Definition Documentation

◆ ein_lifetimebound

#define ein_lifetimebound

[[lifetimebound]]

The argument must be kept alive as long as the result of the function is alive. Should be used for functions that return references or views into the target object.

This is a strong hint that this object "owns" the result and is just letting you borrow it.

Editorial:

As a rule of thumb all pointer arguments should be analyzed to be either ein_noescape or ein_lifetimebound, and ein_lifetimebound should be applied to all methods that return a self-reference

Definition at line 137 of file common.hpp.

◆ ein_nodiscard

#define ein_nodiscard   [[nodiscard]]

C++17 [[nodiscard]].

The user should explicitly throw away the result rather than let it be silently discarded

Note: Despite being already standard, this is used primarily to annotate the definition with a [[nodiscard]] qualifier in DOXYGEN.

Definition at line 165 of file common.hpp.

◆ ein_noescape

#define ein_noescape

portable __attribute__((noescape))

argument is not captured by the function (rust-style borrow)

Definition at line 151 of file common.hpp.