Instead of silently switching to the unique_resource implementation
based on the "allocated" flag if the resource traits don't conform
to the requirements, issue hard compilation errors. This should better
protect against mistakes, where the user assumes unique_resource
behaves as if it is using the resource traits while it actually doesn't.
Improved documentation of requirements for resource traits and documented
the "reduced" form of resource traits, where the traits only provide
the default resource value but otherwise don't change unique_resource
behavior.
Default- and value-constructed pointers to functions are not callable,
and therefore are not accepted as default-constructible condition
function objects and deleters.
Closes https://github.com/Lastique/scope/issues/14.
As suggested by Peter Dimov on boost-dev ML, scope_check functionality
is merged into scope_exit. Thus scope_exit now has an optional condition
function object, which by default always returns true. If a custom
function object is specified, scope_exit works equivalently to the
previous scope_check, i.e. calls the condition function object to check
whether the action function object needs to be called.
The new scope_check scope guard is a generalization of scope_success and
scope_fail and allows specifying arbitrary conditions for executing the
scope exit action. The scope_success and scope_fail have been
reimplemented in terms of scope_check and now also support arbitrary
fail conditions.
Added exception_checker and error_code_checker conditions for testing
for an exception being thrown and for an error code, respectively.
scope_success and scope_fail use exception_checker by default.
Added tests for the new components.