xtd 0.2.0
Loading...
Searching...
No Matches
xtd::scope_exit Struct Reference

Definition

Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) technique. It binds resource acquisition and release to initialization and destruction of a variable that holds the resource. There are times when writing a special class for such a variable is not worth the effort. This is when xtd xtd::scope_exit comes into play.

Namespace
xtd
Library
xtd.core
Remarks
See also scope_exit_ keyword helper.
Warning
Prefer use RAII then xtd::scope_exit.
#include <xtd/xtd>
using namespace xtd;
auto main() -> int {
static auto __scope_exit__ = scope_exit {} + [&] {
console::write_line("scope_exit");
};
//...
console::write_line("do something...");
//...
}
// This code produces the following output:
//
// begin
//
// do something...
//
// end
// scope_exit
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) tech...
Definition scope_exit.hpp:45

The documentation for this struct was generated from the following file: