xtd 0.2.0
Loading...
Searching...
No Matches

◆ scope_exit_

#define scope_exit_

#include <xtd.core/include/xtd/scope_exit.h>

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 scope_exit_ comes into play.

Namespace
xtd
Library
xtd.core
Remarks
See also xtd::scope_exit struct.
Warning
Prefer use RAII then scope_exit_.
#include <xtd/xtd>
using namespace xtd;
auto main() -> int {
console::write_line("scope_exit");
};
console::write_line("begin");
//...
console::write_line();
console::write_line("do something...");
console::write_line();
//...
console::write_line("end");
}
// This code produces the following output:
//
// begin
//
// do something...
//
// end
// scope_exit
#define scope_exit_
Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (RAII) tech...
Definition scope_exit.h:103
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10