Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Finally.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Foundation/Execution/Throw.h"
5
7
8 /*
9 ********************************************************************************
10 ****************** Execution::Private_::FinallySentry **************************
11 ********************************************************************************
12 */
13 template <Common::INoThrowInvocable FUNCTION>
14 inline Private_::FinallySentry<FUNCTION>::FinallySentry (FUNCTION&& f)
15 : fCleanupCodeBlock_{std::forward<FUNCTION> (f)}
16 {
17 }
18 template <Common::INoThrowInvocable FUNCTION>
19 inline Private_::FinallySentry<FUNCTION>::~FinallySentry ()
20 {
21 // No need for IgnoreExceptionsForCall, because we assure its no-throw invocable
22 fCleanupCodeBlock_ ();
23 }
24
25 /*
26 ********************************************************************************
27 ******************************* Execution::Finally *****************************
28 ********************************************************************************
29 */
30 template <Common::INoThrowInvocable FUNCTION>
31 inline auto Finally (FUNCTION&& f) -> Private_::FinallySentry<FUNCTION>
32 {
33 return {std::forward<FUNCTION> (f)};
34 }
35
36}
auto Finally(FUNCTION &&f) -> Private_::FinallySentry< FUNCTION >
Definition Finally.inl:31
STL namespace.