Gromacs  2026.0-dev-20241204-d69d709
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions | Variables
gmx::test::anonymous_namespace{scope_guard.cpp} Namespace Reference

Typedefs

using DeleterType = int(*)(int)
 

Functions

int deleterSetter (int object)
 
std::pair< int,
sg::detail::scope_guard
< BoundDeleter > > 
makeGuard (int object, DeleterType deleter)
 

Variables

static int s_deleterValue = 0
 Global value which is set by the below function. More...
 

Variable Documentation

int gmx::test::anonymous_namespace{scope_guard.cpp}::s_deleterValue = 0
static

Global value which is set by the below function.

A global value is used here because we want to ensure that the scope guards execute a callback function of form int(*)(int) (similar to closing functions used by the HDF5 library, e.g. H5Gclose) when going out of scope.

We need to inspect the value after the guard exits and the simplest way is to use a global variable.