| Home | Libraries | People | FAQ | More

## Class specify_except

boost::contract::specify_except — Allow to specify exception guarantees.

## Synopsis

    // In header: <boost/contract/core/specify.hpp>

    class specify_except {
    public:

      // public member functions
      ~specify_except() noexcept(false);
      template<typename F> specify_nothing except(F const &);
    };

## Description

Allow to specify the functor this library will call to check exception guarantees. This object is internally constructed by the library when users specify contracts calling `boost::contract::function` and similar functions (that is why this class does not have a public constructor).

See Also: Exception Guarantees

### `specify_except` public member functions

1.     ~specify_except() noexcept(false);

   Destruct this object.

   Throws: This is declared `noexcept(false)` since C++11 to allow users to program failure handlers that throw exceptions on contract assertion failures (not the default, see Throw on Failure).

2.     template<typename F> specify_nothing except(F const & f);

   Allow to specify exception guarantees.

   Parameters: |
   `f` | Nullary functor called by this library to check exception guarantees `f()`. Assertions within this functor are usually programmed using ``BOOST_CONTRACT_ASSERT``, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling ``boost::contract::except_failure``). This functor should capture variables by (constant) references (to access the values they will have at function exit).
   Returns: | After exception guarantees have been specified, the object returned by this function does not allow to specify any additional contract.