#include <stlsoft/error/errno_scope.hpp>
DWORD err = errno;
{ stlsoft::errno_scope scope; // Scope the error while we change it
// Some code that changes (or may change) the last error
. . .
errno = ENOMEM; // ... we just do this for pedagogical purposes
} // End of scope - error value replaced to former value
assert(errno == err);
Public Types | |
| typedef errno_scope | class_type |
Public Member Functions | |
Operations | |
| errno_scope () throw () | |
Remembers the current value of errno. | |
| errno_scope (int errno_) throw () | |
Remembers the given value as the value of errno. | |
| ~errno_scope () throw () | |
Replaces the remembered value of errno. | |
Operations | |
| operator int () const | |
The remembered value of errno. | |
| errno_scope | ( | ) | throw () [inline] |
Remembers the current value of errno.
| errno_scope | ( | int | errno_ | ) | throw () [inline, explicit] |
Remembers the given value as the value of errno.
| ~errno_scope | ( | ) | throw () [inline] |
Replaces the remembered value of errno.
| operator int | ( | ) | const [inline] |
The remembered value of errno.
1.5.6