# Loki::CheckForNoThrow< Host > Class Template Reference

`#include <Checker.h>`

List of all members.

## Detailed Description

### template<class Host>
class Loki::CheckForNoThrow< Host >

ContractChecker and StaticChecker Overview
  The ContractChecker and StaticChecker classes have two purposes:
  - provide a mechanism by which programmers can determine which functions violate class/data invariants,
  - and determine which exception safety a function provides.

Class & Data Invariants
  The ContractChecker and StaticChecker define invariants as "expressions that are true for particular data". They uses a function which returns true if all data are valid, and returns false if any datum is invalid. This is called the validator function, and the host class or function provides a pointer to it. The validator could also assert for any invariant which fails rather than return false. If the validator is a static member function, you can use it with checkers in any function, but especially standalone functions and class static functions. If the validator is a non-static member function, you can use it only within non-static member functions.

Exception Safety Levels
  Years ago, David Abrahams formalized a framework for assessing the exception safety level a function provides. His framework describes three levels of guarantees. Any function which does not provide any of these levels is considered unsafe. ContractChecker and StaticChecker determine a function's safety level through the use of policy classes. Checker's policy classes can show if a function provides any of these three guarantees. Since there is no universal way to detect leaks, this facility provides no mechanism for finding leaks, but users may create their own validators which do. StaticChecker's policy classes only provide direct checking for the no-throw and invariant guarantees. With some finesse, a programmer can write a validator for StaticChecker that checks for the Strong guarantee.

- No-throw guarantee: A function will not throw any exceptions.
- Strong guarantee: A function will not change data if an exception occurs. (Which I call the no-change guarantee.)
- Basic guarantee: A function will not leak resources and data will remain in a valid state if an exception occurs. (Which I call either the no-leak or no-break guarantee depending on context.)

Exception Safety Level:
  This exception-checking policy class for ContractChecker asserts if an exception exists. Host classes can use this to show that a member function provides the no-throw exception safety guarantees.

Requirements For Host Class:
  This policy imposes no requirements on a host class.

The documentation for this class was generated from the following file:

- Checker.h