The source code in this directory was obtained from the Loki C++ library, at
http://loki-lib.cvs.sourceforge.net

ScopeGuard was introduced in article that can be found at
http://www.drdobbs.com by searching for 'scopeguard' and
selecting the Dec 01, 2000 article by Andrei Alexandrescu.

Refinements that have been incorporated into the Loki version are described at
http://www.zete.org/people/jlehrer/scopeguard.html

The following example gives Vector::foo() commit-or-rollback functionality
in the presence of exceptions:

struct Vector
{
	void foo();

	typedef std::vector<int> vector_type;
	vector_type d_vec;
};

void Vector::foo()
{
	// 'push_back' can throw
	d_vec.push_back(1);
	// 'pop_back' does not throw
	Loki::ScopeGuard guard1 = Loki::MakeGuard(
	&vector_type::pop_back, vec);

	// 'push_back' can throw
	d_vec.push_back(2);
	// 'pop_back' does not throw
	Loki::ScopeGuard guard2 = Loki::MakeGuard(
		&vector_type::pop_back, vec);

	// 'push_back' can throw
	d_vec.push_back(3);
	// No need for guard on last atomic operation.

	// We got this far without any exceptions so dismiss all undos.
	guard1.Dismiss();
	guard2.Dismiss();
}

