MeshLib C++ Docs
Loading...
Searching...
No Matches
MRFinally.h File Reference
#include "MRMacros.h"
#include <utility>

Go to the source code of this file.

Classes

class  MR::detail::ScopeGuard< F >
struct  MR::detail::MakeScopeGuard< T >

Namespaces

namespace  MR
 Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
namespace  MR::detail
 for internal use: namespace detail is not bound to other languages

Macros

#define MR_FINALLY   DETAIL_MR_FINALLY( ScopeGuard )
#define DETAIL_MR_FINALLY(type_)

Macro Definition Documentation

◆ DETAIL_MR_FINALLY

#define DETAIL_MR_FINALLY ( type_)
Value:
auto MR_CONCAT( _mrScopeGuard, __COUNTER__ ) = ::MR::detail::MakeScopeGuard<::MR::detail::type_>{} ->* [&]() -> void
#define MR_CONCAT(a, b)
Concat strings.
Definition MRMacros.h:17
Definition MRFinally.h:32

◆ MR_FINALLY

#define MR_FINALLY   DETAIL_MR_FINALLY( ScopeGuard )

Usage: MR_FINALLY{...};. Runs the code in braces when exiting the current scope, either normally or via an exception. To run it only on exception, set a flag after the throwing code: bool ok = false; MR_FINALLY{ if ( !ok ) ...; }; ...; ok = true;