|
tvm
|
A group of RAII contexts managed together. More...
#include <with_context.h>
Public Member Functions | |
| WithGroup ()=default | |
| WithGroup (WithGroup &&)=default | |
| WithGroup & | operator= (WithGroup &&)=default |
| WithGroup (const WithGroup &)=delete | |
| WithGroup & | operator= (const WithGroup &)=delete |
| template<typename... Args> | |
| void | Emplace (Args &&... args) |
| Construct a context and enter its scope. | |
| size_t | size () const |
| Number of active contexts in this group. | |
| ~WithGroup () noexcept(false) | |
| Destructor — exits all contexts in reverse order. | |
A group of RAII contexts managed together.
Allows dynamically emplacing multiple context objects that are all exited (in reverse order) when the group is destroyed. ContextType must declare friend class With<ContextType> and provide EnterWithScope() / ExitWithScope() methods.
| ContextType | The context type with EnterWithScope/ExitWithScope. |
|
default |
|
default |
|
delete |
|
inline |
Destructor — exits all contexts in reverse order.
On normal exit: if any ExitWithScope throws, the remaining contexts are still cleaned up, then the first exception is re-thrown.
During stack unwinding: all exceptions are swallowed to avoid std::terminate.
|
inline |
Construct a context and enter its scope.
| args | Arguments forwarded to ContextType constructor. |
|
delete |
|
default |
|
inline |
Number of active contexts in this group.