Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

11.2 RWScopeGuard

RWScopeGuard encapsulates a function to invoke and a set of parameters to pass to that function. It can handle functions that take up to five parameters of any type. The function wrapped by a scope guard is invoked when the guard goes out of scope. As with other automatic objects, scope guards are destroyed in the reverse order of construction.

11.2.1 Construction

In general, construct an RWScopeGuard object by initializing it using one of the rwtMakeScopeGuard() functions:

You can also copy construct it:

However, because RWScopeGuard is not actually a class but a typedef for const RWScopeGuardImp&, it is not default constructible or assignable:

11.2.2 Member Functions

The type RWScopeGuard has only one method, to cancel the automatic invocation of the function bound to the scope guard:

All other functionality relating to RWScopeGuard comes from the rwtMakeScopeGuard() and rwtMakeRef() helper functions, the latter on RWTRefHolder<T>.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.