DoTryFinally()

System::DoTryFinally(T&&, F&&) function

The sigle function that emulates behavior of C#’s try[-catch]-finally statement. During translation of C#’s try[-catch]-finally statement with translator’s option finally_statement_as_lambda set to true, the statement is translated into the invocation of this method.

template<typename T,typename F> std::enable_if_t<Details::is_lambda_void_void<T>::value> System::DoTryFinally(T &&tryBlock, F &&finallyBlock)

Template parameters

ParameterDescription
TThe type of the function object that implements the try[-catch] part of the try[-catch]-finally statement being emulated
FThe type of the function object that implements the finally part of the try[-catch]-finally statement being emulated

Arguments

ParameterTypeDescription
tryBlockT&&The function object whose body contains the implementation of the try[-catch] part of the try[-catch]-finally statemet being emulated
finallyBlockF&&The function object whose body contains the implementation of the finally part of the try[-catch]-finally statement being emulated

System::DoTryFinally(T&&, F&&) function

The sigle function that emulates behavior of C#’s try[-catch]-finally statement. During translation of C#’s try[-catch]-finally statement with translator’s option finally_statement_as_lambda set to true, the statement is translated into the invocation of this method. This overload handles the case in which the return value of the function object that implements the try[-catch] part of the try[-catch]-finally statement is bool.

template<typename T,typename F> std::enable_if_t<Details::is_lambda_void_boolref<T>::value, bool> System::DoTryFinally(T &&tryBlock, F &&finallyBlock)

Template parameters

ParameterDescription
TThe type of the function object that implements the try[-catch] part of the try[-catch]-finally statement being emulated
FThe type of the function object that implements the finally part of the try[-catch]-finally statement being emulated

Arguments

ParameterTypeDescription
tryBlockT&&The function object whose body contains the implementation of the try[-catch] part of the try[-catch]-finally statemet being emulated
finallyBlockF&&The function object whose body contains the implementation of the finally part of the try[-catch]-finally statement being emulated

System::DoTryFinally(T&&, F&&) function

The sigle function that emulates behavior of C#’s try[-catch]-finally statement. During translation of C#’s try[-catch]-finally statement with translator’s option finally_statement_as_lambda set to true, the statement is translated into the invocation of this method. This overload handles the case in which the return value of the function object that implements the try[-catch] part of the try[-catch]-finally statement is bool&.

template<typename T,typename F> std::enable_if_t<Details::is_lambda_nonovoid_boolref<T>::value, std::optional<Details::ResultOf<T, bool &>>> System::DoTryFinally(T &&tryBlock, F &&finallyBlock)

Template parameters

ParameterDescription
TThe type of the function object that implements the try[-catch] part of the try[-catch]-finally statement being emulated
FThe type of the function object that implements the finally part of the try[-catch]-finally statement being emulated

Arguments

ParameterTypeDescription
tryBlockT&&The function object whose body contains the implementation of the try[-catch] part of the try[-catch]-finally statemet being emulated
finallyBlockF&&The function object whose body contains the implementation of the finally part of the try[-catch]-finally statement being emulated

See Also