Module: contract#
Contracts are usually expressed in the form of preconditions, post-conditions and assertions. Some programming languages have built-in support for contracts. So far, the closest in C++ is assertions. But assertions are not expressive and are not consistent. This simple API is intended at offering some rudimentary support of contract programming in the form of preconditions, post-conditions and assertions with three levels of contract enforcement at build time: off, default and audit, while waiting for it to become part of the C++ language in a near future.
Alternative libraries and references#
- libcontract Library to support
contract programming in C++11.
Boost.Contract implements contract programming (a.k.a., Design by Contract or DbC) [1] for the C++ programming language..
N3753, “Centralized Defensive-Programming Support for Narrow Contracts” proposed for C++14 Standard.
N1962, “Proposal to add Contract Programming to C++ (revision 4)” (not adopted for C++11 Standard).
Parts of the documentation#
API reference#
check this out to see the documentation of classes, macros, etc. offered by this module
Build time configuration#
refer to this document to understand how you can set the bahvior of this library with regard to contract enforcement by using a specific compiler definition at build time