mirror of
https://github.com/boostorg/contract.git
synced 2026-07-21 13:13:32 +00:00
copied all release/0_5_0 to master
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.stackdump
|
||||
|
||||
# VI
|
||||
*.swp
|
||||
|
||||
# Boost.Jam outputs
|
||||
bin/
|
||||
|
||||
# Boost.Wave outputs
|
||||
wave.ii
|
||||
|
||||
# QuickBook outputs
|
||||
reference.xml
|
||||
html/
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
See: https://lcaminiti.github.io/boost-contract
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
# Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
# See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
|
||||
|
||||
import build/boost_contract_no ;
|
||||
import testing ;
|
||||
import os ;
|
||||
import feature ;
|
||||
|
||||
BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
|
||||
if ! $(BOOST_ROOT) {
|
||||
exit "Error: set BOOST_ROOT environment variable to Boost root directory" ;
|
||||
}
|
||||
|
||||
rule help_exit ( targets * : sources * : properties * ) {
|
||||
all_nos = "" ;
|
||||
sep = "" ;
|
||||
for local cond in [ boost_contract_no.conds ] {
|
||||
all_nos = "$(all_nos)$(sep)$(cond)" ;
|
||||
sep = "," ;
|
||||
}
|
||||
echo "
|
||||
Usage: bjam [OPTION]... DIR[-CPP_FILE_NAME]
|
||||
Build and run Boost.Contract tests and examples.
|
||||
Using Boost libraries from environment variable: $BOOST_ROOT = $(BOOST_ROOT)
|
||||
|
||||
Options:
|
||||
boost_contract_link=shared, build Boost.Contract library as shared,
|
||||
static,header static, or header-only (shared by default)
|
||||
boost_contract_no=all_yes, contract checking off (all_yea by default)
|
||||
$(all_nos)
|
||||
|
||||
Examples (on Linux-based bash):
|
||||
Build just \"test/public_function/body_throw.cpp\":
|
||||
[test]$ bjam public_function-body_throw
|
||||
Build all targets using MSVC, GCC, and CLang compilers:
|
||||
$ time bjam -q toolset=msvc,gcc,clang ; echo $?
|
||||
Build with all linkages on multiple compilers:
|
||||
$ time bjam -q toolset=msvc,gcc,clang boost_contract_link=static,header ; echo $?
|
||||
Build with all contract checking combinations on multiple compilers:
|
||||
$ time bjam -q toolset=msvc,gcc,clang boost_contract_no=$(all_nos) ; echo $?
|
||||
" ;
|
||||
exit ;
|
||||
}
|
||||
|
||||
project :
|
||||
requirements
|
||||
<toolset>gcc:<cxxflags>-std=c++11
|
||||
<toolset>clang:<cxxflags>-std=c++11
|
||||
|
||||
<include>"./include"
|
||||
|
||||
<include>$(BOOST_ROOT)
|
||||
<library-path>$(BOOST_ROOT)/stage/lib
|
||||
<toolset>gcc:<library>/boost/system//boost_system
|
||||
<toolset>clang:<library>/boost/system//boost_system
|
||||
;
|
||||
use-project boost : $(BOOST_ROOT) ;
|
||||
|
||||
rule subdir-compile-fail ( subdir : cpp_fname : requirements * ) {
|
||||
compile-fail $(subdir)/$(cpp_fname).cpp :
|
||||
<link>shared:<library>../build//boost_contract
|
||||
<link>static:<library>../build//boost_contract
|
||||
<include>$(subdir)
|
||||
$(requirements)
|
||||
:
|
||||
$(subdir)-$(cpp_fname)
|
||||
;
|
||||
}
|
||||
|
||||
rule subdir-run ( subdir : cpp_fname : requirements * ) {
|
||||
run $(subdir)/$(cpp_fname).cpp : : :
|
||||
<link>shared:<library>../build//boost_contract
|
||||
<link>static:<library>../build//boost_contract
|
||||
<include>$(subdir)
|
||||
$(requirements)
|
||||
:
|
||||
$(subdir)-$(cpp_fname)
|
||||
;
|
||||
}
|
||||
|
||||
rule subdir-lib ( subdir : cpp_fname : requirements * ) {
|
||||
lib $(subdir)-$(cpp_fname) : $(subdir)/$(cpp_fname).cpp :
|
||||
<link>shared:<library>../build//boost_contract
|
||||
<link>static:<library>../build//boost_contract
|
||||
<include>$(subdir)
|
||||
$(requirements)
|
||||
;
|
||||
}
|
||||
|
||||
feature.feature boost_contract_link : shared static header :
|
||||
composite propagated link-incompatible ;
|
||||
feature.compose <boost_contract_link>shared : <link>shared ;
|
||||
feature.compose <boost_contract_link>static :
|
||||
<link>static
|
||||
<define>BOOST_CONTRACT_STATIC_LINK
|
||||
;
|
||||
feature.compose <boost_contract_link>header :
|
||||
<define>BOOST_CONTRACT_HEADER_ONLY
|
||||
;
|
||||
|
||||
feature.feature boost_contract_no : all_yes [ boost_contract_no.conds ] :
|
||||
composite propagated link-incompatible ;
|
||||
for local cond in [ boost_contract_no.conds ] {
|
||||
feature.compose <boost_contract_no>$(cond) :
|
||||
[ boost_contract_no.defs_$(cond) ] ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Boost.Contract (see: https://lcaminiti.github.io/boost-contract)
|
||||
|
||||
A library implementing Contract Programming (a.k.a., Design by Contract or DbC)
|
||||
for the C++ programming language.
|
||||
|
||||
All Contract Programming features are supported by this library: subcontracting,
|
||||
class invariants (also static and volatile), postconditions (with old and return
|
||||
values), preconditions, customizable actions on assertion failure (terminate,
|
||||
throw, etc.), optional compilation of assertion and checking, disable assertions
|
||||
while already checking other assertions (to avoid infinite recursion), etc.
|
||||
|
||||
NOTE: In one of its previous versions, this library passed Boost formal review
|
||||
and it was accepted into the Boost libraries. However, the authors have not had
|
||||
time yet to add this library to an official Boost release (see:
|
||||
https://groups.google.com/forum/?fromgroups=#!topic/boost-list/jQ7OjAmos_Y).
|
||||
|
||||
Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
# Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
# See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
|
||||
|
||||
lib boost_contract : ../src/contract.cpp : <boost_contract_link>shared ;
|
||||
lib boost_contract : ../src/contract.cpp : <boost_contract_link>static ;
|
||||
# Build nothing for boost_contract_link=header (ignore errors Bjam gives).
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
|
||||
# Generated file `python boost_contract_no.jam-gen.py > boost_contract_no.jam`.
|
||||
|
||||
# Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
# See: https://lcaminiti.github.io/boost-contract
|
||||
|
||||
module boost_contract_no {
|
||||
|
||||
rule defs_entryinv { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS ; }
|
||||
|
||||
rule defs_pre { return <define>BOOST_CONTRACT_NO_PRECONDITIONS ; }
|
||||
|
||||
rule defs_exitinv { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS ; }
|
||||
|
||||
rule defs_post { return <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_except { return <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_check { return <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS ; }
|
||||
|
||||
rule defs_entryinv_exitinv { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS ; }
|
||||
|
||||
rule defs_entryinv_post { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_entryinv_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_exitinv { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS ; }
|
||||
|
||||
rule defs_pre_post { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_pre_except { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_pre_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_exitinv_post { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_exitinv_except { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_exitinv_check { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_post_except { return <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_post_check { return <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_except_check { return <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS ; }
|
||||
|
||||
rule defs_entryinv_pre_post { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_entryinv_pre_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_pre_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_post { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_post_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_post_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_exitinv_post { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_pre_exitinv_except { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_pre_exitinv_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_post_except { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_pre_post_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_except_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_exitinv_post_except { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_exitinv_post_check { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_exitinv_except_check { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_post_except_check { return <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_post { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_post_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_pre_post_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_post_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_post_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_post_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_exitinv_post_except { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_pre_exitinv_post_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_exitinv_except_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_post_except_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_exitinv_post_except_check { return <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_post_except { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_post_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_post_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_exitinv_post_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_pre_exitinv_post_except_check { return <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
rule defs_entryinv_pre_exitinv_post_except_check { return <define>BOOST_CONTRACT_NO_ENTRY_INVARIANTS <define>BOOST_CONTRACT_NO_PRECONDITIONS <define>BOOST_CONTRACT_NO_EXIT_INVARIANTS <define>BOOST_CONTRACT_NO_POSTCONDITIONS <define>BOOST_CONTRACT_NO_EXCEPTS <define>BOOST_CONTRACT_NO_CHECKS ; }
|
||||
|
||||
|
||||
rule conds { return entryinv pre exitinv post except check entryinv_pre entryinv_exitinv entryinv_post entryinv_except entryinv_check pre_exitinv pre_post pre_except pre_check exitinv_post exitinv_except exitinv_check post_except post_check except_check entryinv_pre_exitinv entryinv_pre_post entryinv_pre_except entryinv_pre_check entryinv_exitinv_post entryinv_exitinv_except entryinv_exitinv_check entryinv_post_except entryinv_post_check entryinv_except_check pre_exitinv_post pre_exitinv_except pre_exitinv_check pre_post_except pre_post_check pre_except_check exitinv_post_except exitinv_post_check exitinv_except_check post_except_check entryinv_pre_exitinv_post entryinv_pre_exitinv_except entryinv_pre_exitinv_check entryinv_pre_post_except entryinv_pre_post_check entryinv_pre_except_check entryinv_exitinv_post_except entryinv_exitinv_post_check entryinv_exitinv_except_check entryinv_post_except_check pre_exitinv_post_except pre_exitinv_post_check pre_exitinv_except_check pre_post_except_check exitinv_post_except_check entryinv_pre_exitinv_post_except entryinv_pre_exitinv_post_check entryinv_pre_exitinv_except_check entryinv_pre_post_except_check entryinv_exitinv_post_except_check pre_exitinv_post_except_check entryinv_pre_exitinv_post_except_check ; }
|
||||
|
||||
} # module
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
print '''
|
||||
# Generated file `python boost_contract_no.jam-gen.py > boost_contract_no.jam`.
|
||||
|
||||
# Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
# See: https://lcaminiti.github.io/boost-contract
|
||||
'''
|
||||
|
||||
# NOTE: Other macros symbols can be added here as needed.
|
||||
conds = ['entryinv', 'pre', 'exitinv', 'post', 'except', 'check']
|
||||
defs = {
|
||||
'entryinv': 'BOOST_CONTRACT_NO_ENTRY_INVARIANTS',
|
||||
'pre': 'BOOST_CONTRACT_NO_PRECONDITIONS',
|
||||
'exitinv': 'BOOST_CONTRACT_NO_EXIT_INVARIANTS',
|
||||
'post': 'BOOST_CONTRACT_NO_POSTCONDITIONS',
|
||||
'except': 'BOOST_CONTRACT_NO_EXCEPTS',
|
||||
'check': 'BOOST_CONTRACT_NO_CHECKS'
|
||||
}
|
||||
|
||||
import itertools
|
||||
print 'module boost_contract_no {\n'
|
||||
s = ''
|
||||
for r in range(len(conds)):
|
||||
for comb in itertools.combinations(conds, r + 1):
|
||||
c = ''
|
||||
d = ''
|
||||
sep = ''
|
||||
for cond in comb:
|
||||
c += sep + cond
|
||||
sep = '_'
|
||||
d += " <define>" + defs[cond]
|
||||
s += ' ' + c
|
||||
print 'rule defs_{0} {{ return {1} ; }}\n'.format(c, d)
|
||||
print '''
|
||||
rule conds {{ return {0} ; }}
|
||||
|
||||
}} # module
|
||||
'''.format(s)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
# Copyright (C) 2008-2017 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
|
||||
# See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
|
||||
|
||||
import quickbook ;
|
||||
using boostbook ;
|
||||
|
||||
doxygen reference
|
||||
:
|
||||
../include/boost/contract.hpp
|
||||
../include/boost/contract_macro.hpp
|
||||
|
||||
../include/boost/contract/assert.hpp
|
||||
../include/boost/contract/base_types.hpp
|
||||
../include/boost/contract/call_if.hpp
|
||||
../include/boost/contract/check.hpp
|
||||
../include/boost/contract/constructor.hpp
|
||||
../include/boost/contract/destructor.hpp
|
||||
../include/boost/contract/function.hpp
|
||||
../include/boost/contract/old.hpp
|
||||
../include/boost/contract/override.hpp
|
||||
../include/boost/contract/public_function.hpp
|
||||
|
||||
../include/boost/contract/core/access.hpp
|
||||
../include/boost/contract/core/check_macro.hpp
|
||||
../include/boost/contract/core/config.hpp
|
||||
../include/boost/contract/core/constructor_precondition.hpp
|
||||
../include/boost/contract/core/exception.hpp
|
||||
../include/boost/contract/core/specify.hpp
|
||||
../include/boost/contract/core/virtual.hpp
|
||||
:
|
||||
<reftitle>"Reference"
|
||||
# Quickbook's Doxygen does not show destructor exception specs.
|
||||
<doxygen:param>PREDEFINED="BOOST_CONTRACT_DETAIL_DOXYGEN BOOST_PP_VARIADICS"
|
||||
<doxygen:param>MACRO_EXPANSION=YES
|
||||
<doxygen:param>INCLUDE_PATH="../include"
|
||||
<doxygen:param>QUIET=YES
|
||||
<doxygen:param>JAVADOC_AUTOBRIEF=YES
|
||||
<doxygen:param>WARN_IF_UNDOCUMENTED=NO
|
||||
<doxygen:param>EXCLUDE_SYMBOLS=std
|
||||
# Following does not work for XML output... use @cond and/or
|
||||
# #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN in code instead.
|
||||
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
<doxygen:param>HIDE_UNDOC_CLASSES=YES
|
||||
<doxygen:param>SHORT_NAMES=NO
|
||||
<doxygen:param>ALIASES=" RefSect{2}=\"\\xmlonly<link linkend='boost_contract.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" RefEnum{1}=\"\\xmlonly<computeroutput><enumname alt='\\1'>\\1</enumname></computeroutput>\\endxmlonly\" "
|
||||
;
|
||||
|
||||
xml contract : main.qbk : <dependency>reference ;
|
||||
|
||||
boostbook doc : contract
|
||||
:
|
||||
<location>html
|
||||
<xsl:param>boost.defaults=Boost
|
||||
<xsl:param>boost.root=../../
|
||||
<xsl:param>admon.graphics.path=../../doc/src/images/
|
||||
<xsl:param>html.stylesheet=../../doc/src/boostbook.css
|
||||
<xsl:param>toc.max.depth=1
|
||||
;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Acknowledgments]
|
||||
|
||||
This section aims to recognize the contributions of all the different people that participated directly or indirectly to the design and development of this library.
|
||||
|
||||
Sincere thanks to my parents for their support with my education and my studies in computer science.
|
||||
|
||||
Many thanks to Andrzej Krzemienski for reviewing early versions of this library providing valuable insights and exchanging early ideas on assertion requirements.
|
||||
|
||||
Many thanks to Vicente J. Botet Escriba for reviewing earlier versions of this library providing valuable insights and for suggesting to use a dedicated trait to copy old values.
|
||||
|
||||
Thanks to Steven Watanabe for providing valuable insights on C++, SFINAE, and introspection.
|
||||
|
||||
Thanks to Dave Abrahams for moderating the Boost review of this library.
|
||||
|
||||
Thanks to David Maley for sharing source code form his inspiring work on emulating Contract Programming and subcontracting in C++ in __Maley99__.
|
||||
|
||||
Many thanks to Thorsten Ottosen for his work on the __N1962__ proposal (and its previous revisions) and for clarifying the proposal requirements directly with the library authors when needed.
|
||||
|
||||
Many thanks to Bertrand Meyer for his pioneering and thorough work on Contract Programming in __Meyer97__.
|
||||
|
||||
Finally, many thanks to the entire Boost community and [@http://lists.boost.org mailing list] for providing valuable comments on this library and great insights on the C++ programming language.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,484 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Advanced]
|
||||
|
||||
This section is a guide to advanced usages of this library.
|
||||
|
||||
[section Pure Virtual Public Functions]
|
||||
|
||||
In C++, pure virtual functions are allowed to have a /default implementation/ as long as such implementation is programmed out-of-line so defined outside the class declaring the pure virtual function `virtual ... = 0;`.
|
||||
|
||||
Contracts for pure virtual public functions are programmed using the [funcref boost::contract::public_function] function like for (non-pure) virtual public functions (all consideration made in __Virtual_Public_Functions__ apply).
|
||||
However, contracts have to be programmed out-of-line, in the default implementation of the pure virtual function.
|
||||
For example (see [@../../example/features/pure_virtual_public.cpp =pure_virtual_public.cpp=]):
|
||||
|
||||
[import ../example/features/pure_virtual_public.cpp]
|
||||
[pure_virtual_public_base_begin]
|
||||
[pure_virtual_public_base_end]
|
||||
[pure_virtual_public_base_impl]
|
||||
|
||||
This library will never actually execute the pure virtual function body while it is calling the pure virtual function default implementation to check contracts for subcontracting.
|
||||
Therefore, programmers can safely `assert(false)` at the beginning of the body if they intend for that body to never be executed (or they can program a working body in case they need to use C++ pure virtual function default implementation as usual with C++).
|
||||
|
||||
[heading Subcontracting Preconditions Always True/False]
|
||||
|
||||
As seen in __Public_Function_Overrides__, preconditions of overriding public functions are checked in __OR__ with preconditions of overridden virtual public functions.
|
||||
Therefore, if a virtual public function in a base class specifies no precondition then preconditions specified by all its overriding functions in derived classes will have no effect (because when checked in __OR__ with the overridden function from the base class that has no preconditions, they will always pass).
|
||||
This correctly reflects the fact that the overridden function in the base class can be called from any context (because it has no precondition) and so must all its overriding functions in all derived classes in accordance to the __substitution_principle__.
|
||||
This is equivalent to declare the virtual public function in a base class with a single precondition `BOOST_CONTRACT_ASSERT(true)` that will always pass:
|
||||
|
||||
// In a virtual public function of a base class.
|
||||
boost::contract::check c = boost::contract::public_function(v, this)
|
||||
.precondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(true); // Prevent preconditions of overrides.
|
||||
})
|
||||
...
|
||||
;
|
||||
|
||||
On the flip side, programmers might sometimes consider to declare a pure virtual public function in a base class with a single precondition `BOOST_CONTRACT_ASSERT(false)` that will always fail.
|
||||
This indicates that the pure virtual public function can never be called unless it is redefined by a derived class (which is actually the case with C++ pure virtual functions) and also that the base class designers have intentionally left it up to derived classes to specify preconditions for the pure virtual function in question.
|
||||
This technique might make sense only for preconditions of pure virtual public functions (otherwise `BOOST_CONTRACT_ASSERT(false)` will prevent calling virtual public functions in concrete bases).
|
||||
For example (see [@../../example/features/named_override.cpp =named_override.cpp=]):
|
||||
|
||||
[import ../example/features/named_override.cpp]
|
||||
[named_override_pure_virtual_assert_false]
|
||||
|
||||
That said, the need to declare such a precondition `BOOST_CONTRACT_ASSERT(false)` that will always fail might be an indication that the base class interface is not correctly designed.
|
||||
In general, the base class interface should still contain all functions (eventually as pure virtual) that are necessary to program its contracts.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Optional Return Value]
|
||||
|
||||
It is possible to use `boost::optional` to handle return values when programmers cannot construct the result variable at its point of declaration before the contract (e.g., because an appropriate constructor for the return type is not available at that point, or just because it would be too expensive to execute an extra initialization of the return value at run-time).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
`boost::optional` is used instead of `std::optional` because `std::optional` is not part of C++ standards prior to C++17.
|
||||
]
|
||||
For example (see [@../../example/features/optional_result.cpp =optional_result.cpp=]):
|
||||
|
||||
[import ../example/features/optional_result.cpp]
|
||||
[optional_result]
|
||||
|
||||
In this example the return type is a reference so it does not have default constructor that can be used to initialize `result` when it is declared before the contract declaration.
|
||||
In addition, `Index` needs to be validated to be smaller than `size()` by the precondition before it can be used to retrieve the reference to be assigned to `result` so `vect[Index]` cannot be used to initialize `result` when it is declared before the contract declaration.
|
||||
Therefore, `boost::optional` is used to defer `result` proper initialization until the execution of the function body after the contract declaration when `Index` has been validated by the precondition and `vect[Index]` can be safely evaluated to initialize `result`.
|
||||
|
||||
As seen in __Return_Value__, it is the responsibility of the programmers to ensure that `result` is always set to the return value (when the function exits without trowing an exception).
|
||||
This also ensures that `result` is always set before the postconditions are checked so programmers can always dereference `result` in postconditions to access the return value (using `operator*` and `operator->` as usual with `boost::optional`, and without having to explicitly check if `result` is an empty `boost::optional` object or not).
|
||||
This can be easily done by making sure that /all/ return statements in the function are of the form:
|
||||
|
||||
boost::optional<...> result;
|
||||
...
|
||||
return *(result = ...); // Assign `result` at each return.
|
||||
|
||||
[heading Optional Results in Virtual Public Functions]
|
||||
|
||||
Similarly, `boost::optional` can be used to handle the return value passed to contracts of virtual public functions (pure or not) and of public function overrides.
|
||||
As seen in __Pure_Virtual_Public_Functions__, __Virtual_Public_Functions__, and __Public_Function_Overrides__, in these cases the return value `result` must be passed as a parameter to [funcref boost::contract::public_function] right after the parameter `v` of type [classref boost::contract::virtual_]`*`.
|
||||
Then the functor passed to `.postcondition(...)` takes one single parameter of type `boost::optional<`[^['result-type]]` const&> const&`.
|
||||
For example (see [@../../example/features/optional_result_virtual.cpp =optional_result_virtual.cpp=]):
|
||||
|
||||
[import ../example/features/optional_result_virtual.cpp]
|
||||
[optional_result_virtual]
|
||||
|
||||
The inner `const&` in the postcondition functor parameter type `boost::optional<... const&> ...` is mandatory (while the outer `const&` in the postcondition functor parameter type `boost::optional<...> const&` is not).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
This library requires the postcondition functor parameter to be of type `boost::optional<... const&>` so the return value does not have to be copied (because of `&`) while postconditions are still not allowed to change its value (because of `const`, see __Constant_Correctness__).
|
||||
In addition, programmers are encouraged to declare the postcondition functor to take its argument also as a constant reference `boost::optional<... const&> const&` to avoid possibly expensive copies of the `boost::optional` type.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Private and Protected Functions]
|
||||
|
||||
Private and protected functions do not check class invariants (because they are not part of the public class interface) and they do not subcontract (because they are not accessible at the calling site where the __substitution_principle__ applies, see __Function_Calls__).
|
||||
However, programmers may still want to specify preconditions and postconditions for private and protected functions when they want to check correctness of their implementation and usage from within the class, base classes, and friend classes or functions.
|
||||
When programmers decide to specify contracts for private and protected functions, they shall use [funcref boost::contract::function] (like for non-member functions).
|
||||
For example (see [@../../example/features/private_protected.cpp =private_protected.cpp=]):
|
||||
|
||||
[import ../example/features/private_protected.cpp]
|
||||
[private_protected]
|
||||
|
||||
Considerations made in __Non_Member_Functions__ apply to private and protected functions as well.
|
||||
|
||||
See __Constructors__ and __Destructors__ on how to program contracts for private and protected constructors and destructors instead.
|
||||
|
||||
[heading Virtual Private and Protected Functions]
|
||||
|
||||
When private and protected functions are virtual they should still declare the extra virtual parameter of type [classref boost::contract::virtual_]`*` with default value `0` (see __Virtual_Public_Functions__) even if that parameter does not have to be passed to [macroref BOOST_CONTRACT_OLDOF] and [funcref boost::contract::function] takes no argument (so the extra virtual parameter will remain unused and it does not need a name).
|
||||
[footnote
|
||||
Technically, the extra virtual parameter can still be passed to [macroref BOOST_CONTRACT_OLDOF] but that is not necessary and it has no effect so it is not done in this documentation.
|
||||
]
|
||||
That is necessary otherwise the private and protected virtual functions cannot be overridden by public functions in derived classes that specify contracts (because the [classref boost::contract::virtual_]`* = 0` parameter has to be part of signatures for public function overrides).
|
||||
For example (see [@../../example/features/private_protected_virtual.cpp =private_protected_virtual.cpp=]):
|
||||
|
||||
[import ../example/features/private_protected_virtual.cpp]
|
||||
[private_protected_virtual_counter]
|
||||
|
||||
However, public functions in derived classes overriding private or protected virtual functions from base classes shall not specify the extra `override_...` template parameter to [funcref boost::contract::public_function] because the overridden functions are private or protected and, not being public, they do not participate to subcontracting (this library will generate a compile-time error if `override_...` is specified because there will be no virtual public function to override from the base class).
|
||||
For example (see [@../../example/features/private_protected_virtual.cpp =private_protected_virtual.cpp=]):
|
||||
|
||||
[private_protected_virtual_counter10]
|
||||
|
||||
Furthermore, using multiple inheritance it is possible to override functions that are private or protected from one base but public from another base.
|
||||
In this case, public function overrides in derived classes will specify the extra `override_...` template parameter to [funcref boost::contract::public_function] (because the overridden functions are private or protected in one base and those do not participate to subcontracting, but public in another base and these participate to subcontracting instead).
|
||||
For example (see [@../../example/features/private_protected_virtual_multi.cpp =private_protected_virtual_multi.cpp=]):
|
||||
|
||||
[import ../example/features/private_protected_virtual_multi.cpp]
|
||||
[private_protected_virtual_multi_countable]
|
||||
[private_protected_virtual_multi_counter10]
|
||||
|
||||
[warning
|
||||
Unfortunately, the code above does not compile on MSVC (at least up to Visual Studio 2015) because MSVC incorrectly gives a compile-time error when SFINAE fails due to private or protected access levels.
|
||||
Instead, GCC and Clang correctly implement SFINAE failures due to private and protected functions so the code above correctly complies on GCC and Clang.
|
||||
Therefore, currently it is not possible to override a function that is public in one base but private or protected in other base using this library on MSVC, but that can be done on GCC or CLang instead.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Friend Functions]
|
||||
|
||||
Friend functions are not member functions so [funcref boost::contract::function] can used to program contracts for them and all considerations made in __Non_Member_Functions__ apply.
|
||||
For example (see [@../../example/features/friend.cpp =friend.cpp=]):
|
||||
|
||||
[import ../example/features/friend.cpp]
|
||||
[friend_byte]
|
||||
[friend_bytes]
|
||||
|
||||
However, in some cases a friend function might take an object as parameter and it can be logically considered an extension of that object's public interface (essentially at the same level as the object's public functions).
|
||||
In these cases, programmers might chose to program the friend function contracts using [funcref boost::contract::public_function] (instead of [funcref boost::contract::function]) so to also check the class invariants of the object passed as parameter (and not just the pre- and postconditions of the friend function).
|
||||
For example (see [@../../example/features/friend_invariant.cpp =friend_invariant.cpp=]):
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Contract programming proposals for C++ like __N1962__ do not provide a mechanism for friend functions to check class invariants of objects passed as parameters.
|
||||
In other words, these proposals do not enable contracts to recognize that in C++ some friend functions logically act as if they were part of the public interface of the objects they take as parameters.
|
||||
This is actually reasonable for proposals that add contracts to the core language because friend functions are not always meant to extend an object public interface and C++ does not provide a mechanism to programmatically specify when they do and when they do not.
|
||||
However, this library adds the flexibility to let programmers manually specify when friend functions should also check class invariants of the objects they take as parameters (using [funcref boost::contract::public_function]) and when they should not (using [funcref boost::contract::function] instead).
|
||||
]
|
||||
|
||||
[import ../example/features/friend_invariant.cpp]
|
||||
[friend_invariant]
|
||||
|
||||
This technique can also be extended to friend functions that take multiple objects as parameters and can be logically considered extensions to the public interfaces of each of these objects.
|
||||
For example:
|
||||
|
||||
// Can be considered an extension of multiple objects' public interfaces.
|
||||
friend void f(class1& object1, class2* object2, type3& value3) {
|
||||
// Check preconditions.
|
||||
boost::contract::check pre = boost::contract::function()
|
||||
.precondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(object2 != nullptr);
|
||||
...
|
||||
})
|
||||
;
|
||||
// Check class invariants for each object (programmers chose the order).
|
||||
boost::contract::check inv1 = boost::contract::public_function(&object1);
|
||||
boost::contract::check inv2 = boost::contract::public_function(object2);
|
||||
// Check postconditions and exception guarantees.
|
||||
boost::contract::check post_except = boost::contract::function()
|
||||
.postcondition(...)
|
||||
.except(...)
|
||||
;
|
||||
|
||||
... // Function body.
|
||||
}
|
||||
|
||||
Changing the order of the [classref boost::contract::check] declarations above, programmers can chose the order for checking class invariants among the different objects passed to the friend function and also whether to check these invariants before or after preconditions, postconditions, and exception guarantees at function entry and exit respectively (see __Non_Member_Functions__ and __Public_Functions__ for information on how the RAII objects returned by [funcref boost::contract::function] and [funcref boost::contract::public_function] check contract conditions).
|
||||
The example above is programmed to check `class1` invariants before `class2` invariants (but the order could have been inverted if programmers so chose).
|
||||
|
||||
[note
|
||||
In the example above, preconditions are intentionally programmed to be checked before class invariants so the objects passed to the friend function can be validated by the preconditions before they are passed as pointers to [funcref boost::contract::public_function] (e.g., check `object2` is not null).
|
||||
(Within member functions instead, the object pointer `this` is always well-formed, its validation is never needed, and [funcref boost::contract::public_function] checks class invariants before checking preconditions so programming preconditions can be simplified assuming the class invariants are satisfied already, see __Public_Function_Calls__.)
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Function Overloads]
|
||||
|
||||
As seen in __Public_Function_Overrides__, [funcref boost::contract::public_function] takes a pointer to the enclosing function as a parameter when used in public function overrides.
|
||||
When names of public function overrides are overloaded, the function pointer cannot be automatically deduced by the compiler so programmers have to use `static_cast` to resolve ambiguities (as usual with pointers to overloaded functions in C++).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
In order to avoid copies, this library takes all function arguments and the return value passed to [funcref boost::contract::public_function] as references when used within public function overrides.
|
||||
Therefore, the library cannot differentiate when the actual function argument and return types are passed by reference and when they are not.
|
||||
As a result, the library cannot automatically reconstruct the type of the enclosing public function so this type must be deduced from the function pointer passed by programmers to [funcref boost::contract::public_function].
|
||||
When this automatic deduction is not possible due to overloaded function names, programmers must explicitly use `static_cast` to resolve ambiguities as usual in C++ with pointers to overloaded functions.
|
||||
]
|
||||
For example, note how `static_cast` is used in the following calls to [funcref boost::contract::public_function] (see [@../../example/features/overload.cpp =overload.cpp=]):
|
||||
|
||||
[import ../example/features/overload.cpp]
|
||||
[overload]
|
||||
|
||||
Overloaded functions have the same function name so the same [^override_['function-name]] type can be reused as template parameter for all [funcref boost::contract::public_function] calls.
|
||||
Therefore, [macroref BOOST_CONTRACT_OVERRIDE] only needs to be invoked once for any given function name even when that function name is overloaded.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Lambdas, Loops, Code Blocks (and `constexpr`)]
|
||||
|
||||
While contracts are usually most useful to program specifications of functions and class interfaces, this library also allows to check contract conditions for implementation code (lambda functions, loops, code blocks, etc.).
|
||||
|
||||
Lambda functions are not member functions, they are not part of class public interfaces so they do not check class invariants or participate int subcontracting.
|
||||
They can use [funcref boost::contract::function] to specify preconditions, postconditions, and exception guarantees (considerations made in __Non_Member_Functions__ apply).
|
||||
For example (see [@../../example/features/lambda.cpp =lambda.cpp=]):
|
||||
|
||||
[import ../example/features/lambda.cpp]
|
||||
[lambda]
|
||||
|
||||
Similarly, [funcref boost::contract::function] can be used to program preconditions, postconditions, and exception guarantees for loops.
|
||||
For example, for a for-loop but same for while- and all other loops (see [@../../example/features/loop.cpp =loop.cpp=]):
|
||||
|
||||
[import ../example/features/loop.cpp]
|
||||
[loop]
|
||||
|
||||
More in general, [funcref boost::contract::function] can be used to program preconditions, postconditions, and exception guarantees of any block of code in a given function.
|
||||
For example (see [@../../example/features/code_block.cpp =code_block.cpp=]):
|
||||
|
||||
[import ../example/features/code_block.cpp]
|
||||
[code_block]
|
||||
|
||||
Finally, at the moment this library does not support contracts for functions and classes declared `constexpr`.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
In general, it might be useful to specify contracts for `constexpr` functions and literal classes.
|
||||
However, the implementation of this library cannot support contracts for these functions and classes because C++ does not currently allow `constexpr` functions to do the following:
|
||||
Declare local variables of (literal) types with non-trivial `constexpr` destructors (this RAII technique is used by this library to check invariants, postconditions, and exceptions guarantees at exit);
|
||||
Call other `constexpr` functions using try-catch statements (used by this library to report contract assertion failures and catch any other exception that might be thrown when evaluating the asserted conditions);
|
||||
Use lambda functions (used by this library for convenience to program functors that that check preconditions, postconditions, and exception guarantees).
|
||||
Also note that even if supported, contracts for `constexpr` functions probably would not use old values (because `constexpr` prevents functions from having any side effect visible to the caller and variables recording such side-effects are usually the candidates for old value copies) and subcontracting (because `constexpr` functions cannot be virtual).
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Implementation Checks]
|
||||
|
||||
This library provides a mechanism to check assertions within implementation code outside of preconditions, postconditions, exceptions guarantees, and class invariants.
|
||||
These implementation checks can be programmed using [macroref BOOST_CONTRACT_ASSERT] in a nullary functor that is directly assigned to [classref boost::contract::check] at the place within the code where the checks have to be executed (so without using [funcref boost::contract::function], [funcref boost::contract::public_function], etc.).
|
||||
For example (see [@ ../../example/features/check.cpp =check.cpp=]):
|
||||
|
||||
[import ../example/features/check.cpp]
|
||||
[check_class]
|
||||
|
||||
Alternatively, this library provides the [macroref BOOST_CONTRACT_CHECK] macro that allows to completely remove run- and compile-time overhead of implementation checks when [macroref BOOST_CONTRACT_NO_CHECKS] is defined.
|
||||
For example (see [@ ../../example/features/check.cpp =check.cpp=]):
|
||||
|
||||
[check_macro]
|
||||
|
||||
(See __Disable_Contract_Checking__ and __Disable_Contract_Compilation__ for macros to completely remove run- and compile-time overhead of preconditions, postconditions, exception guarantees, and class invariants.)
|
||||
|
||||
These implementation checks are essentially equivalent to using the C-style `assert` macro a part from the following:
|
||||
|
||||
* A failure of the implementation checks will call [funcref boost::contract::check_failure] (see [funcref boost::contract::set_check_failure] and [funcref boost::contract::get_check_failure]).
|
||||
* Implementation checks are automatically disabled when other contract conditions specified using this libraries are already being checked (to avoid infinite recursion, see [macroref BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION]).
|
||||
* Implementation checks are disabled defining [macroref BOOST_CONTRACT_NO_CHECKS] (instead of `NDEBUG` for disabling `assert`).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Old Copies at Body]
|
||||
|
||||
In the examples seen so far, old value variables of type [classref boost::contract::old_ptr] are initialized to a copy of the expression passed to [macroref BOOST_CONTRACT_OLDOF] at the point of their declaration.
|
||||
This is correctly done before the function body is executed but it is also done before the contract is declared, therefore even before class invariants (for public functions) and preconditions are checked at function entry.
|
||||
|
||||
This might work well in most cases, however in general old values should be copied before executing the function body but after checking entry class invariants and preconditions (see __Assertions__).
|
||||
Specifically, there could be cases in which it makes sense to evaluate the expressions passed to [macroref BOOST_CONTRACT_OLDOF] only assuming that the assertions programmed in the class invariants and preconditions are first checked to be true.
|
||||
|
||||
This library allows to construct [classref boost::contract::old_ptr] variables using their default constructor (equivalent to a null pointer) and then to assign them later to a copy of the expression passed to [macroref BOOST_CONTRACT_OLDOF] in a nullary functor [^['d]]`()` passed to `.old(`[^['d]]`)`.
|
||||
The functor [^['d]]`()` is called by this library before the function body is executed but only after class invariants and preconditions are checked:
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Functors for preconditions, old value assignments, postconditions, and exception guarantees are all optional but when specified, they must be specified in that order.
|
||||
Such order is enforced by the fact that [classref boost::contract::specify_precondition_old_postcondition_except], [classref boost::contract::specify_old_postcondition_except], [classref boost::contract::specify_postcondition_except], [classref boost::contract::specify_except], and [classref boost::contract::specify_nothing] provide a progressively decreasing subset of the `.precondition(...)`, `.old(...)`, `.postcondition(...)`, and `.except(...)` member functions.
|
||||
The enforced order for specifying preconditions, old value assignments, postconditions, and exception guarantees makes logical sense because it follows the order at which these are executed at run-time.
|
||||
Other contract programming frameworks allow to mix this order, that could have been implemented for this library as well but it would have complicated somewhat the library implementation while adding no real value (arguably creating confusion in user code by not enforcing a consistent order for specifying contract conditions).
|
||||
]
|
||||
|
||||
boost::contract::old_ptr<...> old_``[^['name]]``; // Default constructor (i.e., null pointer).
|
||||
...
|
||||
boost::contract::guard c = boost::contract::function() // Same for all other contracts.
|
||||
...
|
||||
.old([&] { // Capture by reference...
|
||||
old_``[^['name]]`` = BOOST_CONTRACT_OLDOF(``[^['expression]]``); // ...but modify only old values.
|
||||
...
|
||||
})
|
||||
.postcondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(*old_``[^['name]]`` ...); // Never null here.
|
||||
...
|
||||
})
|
||||
.except([&] {
|
||||
BOOST_CONTRACT_ASSERT(*old_``[^['name]]`` ...); // Never null here.
|
||||
...
|
||||
})
|
||||
;
|
||||
|
||||
For example, the following old value expression `s[index]` passed to [macroref BOOST_CONTRACT_OLDOF] is valid only after the precondition has checked that `index` is within valid range `index < s.size()`.
|
||||
Therefore, `old_y` is first declared using its default constructor (i.e., initialized to a null pointer) and later assigned to a copy of `s[index]` in `.old(...)` after the precondition has checked `index` (see [@../../example/features/old.cpp =old.cpp=]):
|
||||
|
||||
[import ../example/features/old.cpp]
|
||||
[old]
|
||||
|
||||
The functor passed to `.old(...)` should capture all variables it needs to evaluate to copy the old value expressions passed to [macroref BOOST_CONTRACT_OLDOF].
|
||||
In general, these variables should be captured by reference and not by value (because old values need to make copies of the values the captured variables will have just before executing the function body, and not copy the values these variables had when the functor passed to `.old(...)` was first declared).
|
||||
In any case, the functor passed to `.old(...)` should modify only old values and not the values of other captured variables (see __Constant_Correctness__).
|
||||
|
||||
This library will automatically call the failure handler [funcref boost::contract::old_failure] if calling the functor specified via `.old(...)` throws an exception (by default, this handler prints an error message to `std::cerr` and terminates the program calling `std::terminate`, but see __Throw_on_Failure__ to throw exceptions, exit the program with an error code, etc.).
|
||||
|
||||
[note
|
||||
If old value pointers are initialized at the point of their construction instead of using `.old(...)` then an exception thrown by the old value expression passed to [macroref BOOST_CONTRACT_OLDOF], or more in general any exception thrown by the old value pointer initialization, will result in that exception being thrown up the stack by the enclosing function.
|
||||
This is arguably less correct than calling [funcref boost::contract::old_failure] because an exception thrown by an old value copy causes the program to fail checking its postconditions and exception guarantees but should not automatically causes the enclosing function to thrown an exception (this might not be a significant difference in practice, but it could be an additional reason to use `.old(...)` instead of copying old values when they are declared before the contract).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
It would be possible to wrap all old value operations ([classref boost::contract::old_ptr] copy constructor, [funcref boost::contract::make_old], etc.) in try-catch statements so this library will call [funcref boost::contract::old_failure] also when old values are copied when they are constructed outside `.old(...)`.
|
||||
However, that will prevent this library from knowing the [enumref boost::contract::from] parameter and that would be problematic (specifically because destructors can have postconditions so that parameter is necessary to make sure user-defined failure handlers can be programmed to never throw from destructors as C++ usually requires).
|
||||
]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Named Overrides]
|
||||
|
||||
The function names passed to [macroref BOOST_CONTRACT_OVERRIDE] and [macroref BOOST_CONTRACT_OVERRIDES] should never start with an underscore to avoid generating names containing double underscores `override__...` (which are reserved by the C++ standard).
|
||||
There is a separate macro [macroref BOOST_CONTRACT_NAMED_OVERRIDE] that can be used to explicitly specify the name of the type that will be passed to [funcref boost::contract::public_function] as a template argument:
|
||||
[footnote
|
||||
*Rationale:*
|
||||
A different macro [macroref BOOST_CONTRACT_NAMED_OVERRIDE] is used instead of overloading [macroref BOOST_CONTRACT_OVERRIDE] using variadic macros because the override macros cannot be programmed manually by users so making it a variadic would prevent to use this library on compilers that do not support variadic macros (see __No_Macros__).
|
||||
]
|
||||
|
||||
BOOST_CONTRACT_OVERRIDE(``[^['function-name]]``) // Generate `override_...`.
|
||||
BOOST_CONTRACT_NAMED_OVERRIDE(``[^['type-name]]``, ``[^['function-name]]``) // Generate `type-name`.
|
||||
|
||||
For example, the following public function override is named `_1` so `BOOST_CONTRACT_OVERRIDE(_1)` would generate a type named `override__1` (which is reserved in C++ because it contains double underscores `__`), `BOOST_CONTRACT_NAMED_OVERRIDE(override1, _1)` is used to name the type `override1` instead (see [@../../example/features/named_override.cpp =named_override.cpp=]):
|
||||
|
||||
[named_override]
|
||||
|
||||
The [macroref BOOST_CONTRACT_NAMED_OVERRIDE] macro can also be used when the name `override_`[^['function-name]] generated by [macroref BOOST_CONTRACT_OVERRIDE] would clash with other names in user code, to generate names in CamelCase or in any other preferred style, and in any other case when programmers need or prefer to generate names different from `override_...`.
|
||||
|
||||
Note that there is not a `BOOST_CONTRACT_NAMED_OVERRIDES` macro so [macroref BOOST_CONTRACT_NAMED_OVERRIDE] needs to be invoked separately on each function name (there is instead a [macroref BOOST_CONTRACT_OVERRIDES] macro as seen in __Public_Function_Overrides__).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
The syntax for invoking a possible `BOOST_CONTRACT_NAMED_OVERRIDES` macro would need to be something like `BOOST_CONTRACT_NAMED_OVERRIDES(`[^['type-name1]]`, `[^['function-name1]]`, `[^['type-name2]]`, `[^['function-name2]]`, ...)`.
|
||||
The authors felt this syntax is less readable than repeating single `BOOST_CONTRACT_NAMED_OVERRIDE` invocations `BOOST_CONTRACT_NAMED_OVERRIDE(`[^['type-name1]]`, `[^['function-name1]]`) BOOST_CONTRACT_NAMED_OVERRIDE(`[^['type-name2]]`, `[^['function-name2]]`) ...` so decided not to provide the `BOOST_CONTRACT_NAMED_OVERRIDES` macro.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Access Specifiers]
|
||||
|
||||
As we have seen so far, programmers are required to decorate their classes declaring extra members that are internally used by this library to check contracts:
|
||||
|
||||
* The `invariant` and `static_invariant` member functions (used to check class invariants, see __Class_Invariants__).
|
||||
* The `base_types` member type declared via [macroref BOOST_CONTRACT_BASE_TYPES] (used to implement subcontracting, see __Public_Function_Overrides__).
|
||||
* The `override_...` member types declared via [macroref BOOST_CONTRACT_OVERRIDE], [macroref BOOST_CONTRACT_NAMED_OVERRIDE], and [macroref BOOST_CONTRACT_OVERRIDES] (used to implement subcontracting for overriding functions, see __Public_Function_Overrides__).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
The internals of the `override_...` type generated by [macroref BOOST_CONTRACT_OVERRIDE] use names reserved by this library so programmers should not actually use such a type even when it is declared `public`.
|
||||
]
|
||||
|
||||
In general, these members must be declared `public` in the user class in order for this library to be able to access them.
|
||||
[footnote
|
||||
There is some variability among compiler implementations:
|
||||
The `base_types` member type needs to be declared `public` on MSVC, GCC, ang CLang;
|
||||
The `invariant` and `static_invariant` member functions need to be declared `public` on MSVC, but not on GCC and CLang;
|
||||
The `override_...` member types do not have to be declared `public` on any compiler.
|
||||
In any case, declaring the [classref boost::contract::access] class `friend` allows to always declare all these extra members `private` on all compilers.
|
||||
]
|
||||
However, programmers might need to more precisely control the public members of their classes to prevent incorrect access of encapsulated members.
|
||||
All these members can be declared `private` as long as the [classref boost::contract::access] class is declared as `friend` of the user class.
|
||||
For example (see [@../../example/features/access.cpp =access.cpp=]):
|
||||
|
||||
[import ../example/features/access.cpp]
|
||||
[access]
|
||||
|
||||
This technique is not used in most examples of this documentation only for brevity, but programmers are encouraged to use it in real code.
|
||||
|
||||
[warning
|
||||
Not declaring this class friend of user classes might cause compiler errors on some compilers (e.g., MSVC) because the private members needed to check the contracts will not be accessible.
|
||||
On other compilers (e.g., GCC and CLang), the private access will instead fail SFINAE and no compiler error will be reported while invariants and subcontracting will be silently skipped at run-time.
|
||||
Therefore, programmers should always make sure to either declare invariant functions and base types `typedef` as public members or to declare the [classref boost::contract::access] class as friend.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Throw on Failure (and `noexcept`)]
|
||||
|
||||
If a conditions checked using [macroref BOOST_CONTRACT_ASSERT] is evaluated to be `false` or more in general if any of the specified contract code throws an exception ([macroref BOOST_CONTRACT_ASSERT] simply expands to code that throws a [classref boost::contract::assertion_failure] exception, see __No_Macros__), this library will call an appropriate /contract failure handler/ function as follow:
|
||||
|
||||
* Preconditions: False [macroref BOOST_CONTRACT_ASSERT] assertions and exceptions thrown from within `.precondition(...)` call [funcref boost::contract::precondition_failure].
|
||||
* Postconditions: False [macroref BOOST_CONTRACT_ASSERT] assertions and exceptions thrown from within `.postcondition(...)` call [funcref boost::contract::postcondition_failure].
|
||||
* Exceptions guarantees: False [macroref BOOST_CONTRACT_ASSERT] assertions and exceptions thrown from within `.except(...)` call [funcref boost::contract::except_failure].
|
||||
* Class invariants: False [macroref BOOST_CONTRACT_ASSERT] assertions and exceptions thrown from `invariant()` and `static_invariant()` call [funcref boost::contract::entry_invariant_failure] when checked at function entry and [funcref boost::contract::exit_invariant_failure] when checked at function exit.
|
||||
* Old copies at body: Exceptions thrown from old value copies at body within `.old(...)` call [funcref boost::contract::old_failure].
|
||||
* Implementation checks: False [macroref BOOST_CONTRACT_ASSERT] assertions and exceptions thrown from implementation checks `boost::contract::check c = `[^['nullary-functor]] and [macroref BOOST_CONTRACT_CHECK] calls [funcref boost::contract::check_failure].
|
||||
|
||||
By default, these contract failure handlers print a message to the standard error `std::cerr` and then terminate the program calling `std::terminate`.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
In general, when a contract fails the only safe thing to do is to terminate program execution (because the contract failure indicates a bug in the program, and in general the program is in a state for which no operation can be successfully performed, so the program should be stopped).
|
||||
Therefore, this library terminates the program by default.
|
||||
However, for specific applications, programmers could implement some fail-safe mechanism for which some mission-critical operation could always be performed upon handling failures so this library allows programmers to override the default contract failure handlers to fully customize how to handle contract failures.
|
||||
]
|
||||
However, programmers can override the default contract failure handlers to perform any custom action on contract failure using the following functions respectively:
|
||||
|
||||
* Preconditions: [funcref boost::contract::set_precondition_failure].
|
||||
* Postconditions: [funcref boost::contract::set_postcondition_failure].
|
||||
* Exception guarantees: [funcref boost::contract::set_except_failure].
|
||||
* Class invariants: [funcref boost::contract::set_entry_invariant_failure] and [funcref boost::contract::set_exit_invariant_failure], or [funcref boost::contract::set_invariant_failure] (to set both entry and exit invariant failure handlers at once for convenience).
|
||||
* Old copies at body: [funcref boost::contract::set_old_failure].
|
||||
* Implementation checks: [funcref boost::contract::set_check_failure].
|
||||
|
||||
These `set_..._failure(`[^['f]]`)` function calls return the contract failure handler functor [^['f]] that they take as input parameter.
|
||||
For example (see [@../../example/features/throw_on_failure.cpp =throw_on_failure.cpp=]):
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Even if somewhat different from `std::set_terminate`, the `set_..._failure` functions take a functor as parameter (so to handle not just function pointers, but also lambdas, binds, etc.) and return this same functor as result (so they can be concatenated).
|
||||
The related `get_..._failure` functions can be used to query the functors currently set as failure handlers.
|
||||
]
|
||||
|
||||
[import ../example/features/throw_on_failure.cpp]
|
||||
[throw_on_failure_handlers]
|
||||
|
||||
When programming custom failure handlers that trow exceptions instead of terminating the program, programmers should be wary of the following:
|
||||
|
||||
* In order to comply with C++ and STL exception safety, destructors should never throw.
|
||||
This library passes a [enumref boost::contract::from] parameter to the contract failure handlers for preconditions ([funcref boost::contract::precondition_failure]), postconditions ([funcref boost::contract::postcondition_failure]), class invariants ([funcref boost::contract::entry_invariant_failure] and [funcref boost::contract::exit_invariant_failure]), and old value copies at body ([funcref boost::contract::old_failure]).
|
||||
This [enumref boost::contract::from] parameter indicates if the contract failure occurred in a destructor, constructor, or function call so programmers can use it to code custom contract failure hander functions that never throw from destructors.
|
||||
(In the example above, contract failures from destructors are simply ignored even if that is probably never a safe thing to do in real code.)
|
||||
* C++ stack-unwinding will execute base class destructors even when the derived class destructor trows an exception.
|
||||
Therefore, the contracts of base class destructors will continue to be checked when contract failure handlers are programmed to throw exceptions on contract failures from destructors (yet another reason to not throw exception from destructors, not even for contract failures).
|
||||
* Implementation checks can appear in any code, including destructor implementation code, so [funcref boost::contract::check_failure] should also never throw, or implementation checks should never be used in destructors (note that [funcref boost::contract::check_failure] does not provide the [enumref boost::contract::from] parameter so it is not possible to differentiate from implementation checks failing from destructors instead than from other parts of the code).
|
||||
* The contract failure handler for exception guarantees [funcref boost::contract::except_failure] should also never throw (regardless of the value of its [enumref boost::contract::from] parameter) because when [funcref boost::contract::except_failure] is called there is already an active exception on the stack, the exception that triggered the exception guarantees to be checked in the first place (and throwing an exception while there is already an active exception will force C++ to terminate the program or lead to undefined behaviour).
|
||||
|
||||
[note
|
||||
It is the responsibility of the programmers to decide how to handle contract failures from destructors when they program custom contract failure handlers that throw exceptions instead of terminating the program (given that C++ and STL exception safety rules requires destructors to never throw).
|
||||
This is not a simple dilemma and it might be a good reason to terminate the program instead of throwing exceptions when assertions fail in C++ (as this library and also C-style `assert` do by default).
|
||||
]
|
||||
|
||||
Contract assertions can be programmed to throw [classref boost::contract::assertion_failure] using [macroref BOOST_CONTRACT_ASSERT]`(`[^['condition]]`)` as we have seen so far (see __No_Macros__).
|
||||
Alternatively, contract assertions can be programmed to throw any other exception (including user-defined exceptions) using code similar to the following:
|
||||
|
||||
if(!``[^['condition]]``) throw ``[^['exception-object]]``;
|
||||
|
||||
For example, if the following precondition functor throws the user-defined exception `too_large_error` then the contract failure handler [funcref boost::contract::precondition_failure] will be called (same as when preconditions programmed using [macroref BOOST_CONTRACT_ASSERT] fail, see [@../../example/features/throw_on_failure.cpp =throw_on_failure.cpp=]):
|
||||
|
||||
[throw_on_failure_class_begin]
|
||||
[throw_on_failure_ctor]
|
||||
[throw_on_failure_class_end]
|
||||
|
||||
Finally, note that the exception specifiers `noexcept` (since C++11) and `throw` (deprecated in C++11) of the enclosing operation declaring the contract correctly apply to the contract code as well.
|
||||
Therefore, even if the contract failure handlers are reprogrammed to throw exceptions in case of contract failures, those exceptions will never be thrown outside the context of the enclosing operation if that is not in accordance with the exception specifiers of that operation (e.g., note that all destructors are implicitly declared `noexcept` in C++11).
|
||||
For example, the following code will correctly never throw from the `noexcept` destructor, not even if the class invariants checked at destructor entry throw `too_large_error` and the contract failure handlers for invariants are programmed to throw from destructors (the program will always terminate in this case instead, see [@../../example/features/throw_on_failure.cpp =throw_on_failure.cpp=]):
|
||||
|
||||
[throw_on_failure_class_begin]
|
||||
[throw_on_failure_dtor]
|
||||
[throw_on_failure_class_end]
|
||||
[throw_on_failure_bad_handler]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Bibliography]
|
||||
|
||||
This section lists all references consulted while designing and developing this library.
|
||||
|
||||
[#Andrzej13_anchor] [Andrzej13] A. Krzemienski. [@https://akrzemi1.wordpress.com/2013/01/04/preconditions-part-i/ /Andrzej's C++ blog: Preconditions/]. 2013.
|
||||
|
||||
[#Bright04_anchor] [Bright04] W. Bright. [@http://www.digitalmars.com/d/2.0/dbc.html /Contract Programming for the D Programming Language/]. 2004.
|
||||
|
||||
[#Bright04b_anchor] [Bright04b] W. Bright. [@http://www.digitalmars.com/ctg/contract.html /Contract Programming for the Digital Mars C++ Compiler/]. 2004.
|
||||
|
||||
[#C2_anchor] [C2] Aechmea. [@http://www.programmersheaven.com/app/news/DisplayNews.aspx?NewsID=3843 /C^2 Contract Programming add-on for C++/]. 2005.
|
||||
|
||||
[#Chrome_anchor] [Chrome] RemObjects. [@http://blogs.remobjects.com/blogs/mh/2008/05/01/p216 /Chrome: Contract Programming for Object Pascal in .NET/]. 2002.
|
||||
|
||||
[#Clarke06_anchor] [Clarke06] L. A. Clarke and D. S. Rosenblum. [@http://discovery.ucl.ac.uk/4991/1/4991.pdf /A Historical Perspective on Runtime Assertion Checking in Software Development/]. Newsletter ACM SIGSOFT Software Engineering Notes, 2006.
|
||||
|
||||
[#Cline90_anchor] [Cline90] M. Cline and D. Lea. /The Behaviour of C++ Classes/ and [@http://surface.syr.edu/cgi/viewcontent.cgi?article=1116&context=eecs /Using Annotated C++/]. Proc. of the Symposium on Object Oriented Programming Emphasizing Practical Applications, Maris College, 1990.
|
||||
|
||||
[#Ellis90_anchor] [Ellis90] M. A. Ellis and B. Stroustrup. /The Annotated C++ Reference Manual/. ANSI Base Document, Addison Wesley, 1990.
|
||||
|
||||
[#Gautron92_anchor] [Gautron92] P. Gautron. /An Assertion Mechanism Based on Exceptions/. Fourth C++ Technical Conference, 1992.
|
||||
|
||||
[#Hoare73_anchor] [Hoare73] C. A. R. Hoare. /Hints on Programming Language Design/. Stanford University Artificial Intelligence memo AIM-224/STAN-CS-73-403, pages 193-216, 1973.
|
||||
|
||||
[#CodeContracts_anchor] [CodeContracts] Microsoft Research. [@http://research.microsoft.com/en-us/projects/contracts/ /Code Contracts: Design-By-Contract Programming for All .NET Programming Languages/]. 2012.
|
||||
|
||||
[#iContract_anchor] [iContract] O. Enseling. [@http://www.javaworld.com/javaworld/jw-02-2001/jw-0216-cooltools.html /iContract: Contract Programming for Java/]. 2001.
|
||||
|
||||
[#Jcontract_anchor] [Jcontract] Parasoft. [@http://www.parasoft.com/jsp/products/article.jsp?label=product_info_Jcontract /Jcontract: Contract Programming for Java/].
|
||||
|
||||
[#Lindrud04_anchor] [Lindrud04] J. Lindrud. [@http://www.codeproject.com/Articles/8293/Design-by-Contract-in-C /Design by Contract in C++/]. 2004.
|
||||
|
||||
[#Maley99_anchor] [Maley99] D. Maley and I. Spence. [@http://www.computer.org/portal/web/csdl/doi/10.1109/TOOLS.1999.779000 /Emulating Design by Contract in C++/]. Proceedings of TOOLS, IEEE Computer Society, 1999.
|
||||
|
||||
[#Meyer97_anchor] [Meyer97] B. Meyer. /Object Oriented Software Construction/. Prentice-Hall, 2nd edition, 1997.
|
||||
|
||||
[#Mitchell02_anchor] [Mitchell02] R. Mitchell and J. McKim. /Design by Contract, by Example/. Addison-Wesley, 2002.
|
||||
|
||||
[#N1613_anchor] [N1613] T. Ottosen. [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1613.pdf /Proposal to add Design by Contract to C++/]. The C++ Standards Committee, N1613, 2004.
|
||||
|
||||
[#N1653_anchor] [N1653] C. Nelson. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm /Working draft changes for C99 preprocessor synchronization/]. C++ Standards Committee, N1653, 2004.
|
||||
|
||||
[#N1669_anchor] [N1669] T. Ottosen. [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1669.html /Proposal to add Contract Programming to C++ (revision 1)/]. The C++ Standards Committee, N1669, 2004.
|
||||
|
||||
[#N1773_anchor] [N1773] D. Abrahams, L. Crowl, T. Ottosen, and J. Widman. [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1773.html /Proposal to add Contract Programming to C++ (revision 2)/]. The C++ Standards Committee, N1773, 2005.
|
||||
|
||||
[#N1866_anchor] [N1866] L. Crowl and T. Ottosen. [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1866.html /Proposal to add Contract Programming to C++ (revision 3)/]. The C++ Standards Committee, N1866, 2005.
|
||||
|
||||
[#N1895_anchor] [N1895] H. Sutter and F. Glassborow. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1895.pdf /Delegating Constructors (revision 2)/]. C++ Standards Committee, N1895, 2005.
|
||||
|
||||
[#N1962_anchor] [N1962] L. Crowl and T. Ottosen. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1962.html /Proposal to add Contract Programming to C++ (revision 4)/]. The C++ Standards Committee, N1962, 2006.
|
||||
|
||||
[#N2081_anchor] [N2081] D. Gregor and B. Stroustrup. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2081.pdf /Concepts (revision 1)/]. The C++ Standards Committee, N2081, 2006.
|
||||
|
||||
[#N2887_anchor] [N2887] G. Dos Reis, B. Stroustrup, and A. Meredith. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2887.pdf /Axioms: Semantics Aspects of C++ Concepts/]. The C++ Standards Committee, N2887, 2009.
|
||||
|
||||
[#N2914_anchor] [N2914] P. Becker. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2914.pdf /Working Draft, Standard for Programming Language C++/]. The C++ Standards Committee, N2914, 2009.
|
||||
|
||||
[#N2906_anchor] [N2906] B. Stroustrup. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2906.pdf /Simplifying the sue of concepts/]. The C++ Standards Committee, N2906, 2009.
|
||||
|
||||
[#N3248_anchor] [N3248] J. Lakos. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3248.pdf ['[^noexcept] Prevents Library Validation]]. The C++ Standards Committee, N3248, 2011.
|
||||
|
||||
[#N4154_anchor] [N4154] D. Krauss. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4154.pdf ['Operator [^assert]]]. The C++ Standards Committee, N4154, 2014.
|
||||
|
||||
[#N4160_anchor] [N4160] A. Krzemienski. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4160.html /Value constraints/]. The C++ Standards Committee, N4160, 2014.
|
||||
|
||||
[#N4248_anchor] [N4248] A. Meredith. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4248.html /Library Preconditions are a Language Feature/]. The C++ Standards Committee, N4248, 2014.
|
||||
|
||||
[#N4293_anchor] [N4293] J. D. Garcia. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4293.pdf /C++ language support for contract programming/]. The C++ Standards Committee, N4293, 2014.
|
||||
|
||||
[#N4378_anchor] [N4378] J. Lakos, N. Myers, A. Zakharov, and A. Beels. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4378.pdf /Language Support for Contract Assertions (Revision 10)/]. The C++ Standards Committee, N4378, 2015.
|
||||
|
||||
[#Nana_anchor] [Nana] P. J. Maker. [@https://github.com/pjmaker/nana /GNU Nana/]. 2014.
|
||||
|
||||
[#N4379_anchor] [N4378] J. Lakos and N. Myers. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4379.pdf /FAQ about Contract Assertions/]. The C++ Standards Committee, N4379, 2015.
|
||||
|
||||
[#N4435_anchor] [N4435] W. E. Brown. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4435.pdf /Proposing Contract Attributes/]. The C++ Standards Committee, N4435, 2015.
|
||||
|
||||
[#P0147_anchor] [P0147] L. Crowl. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0147r0.html /The Use and Implementation of Contracts/]. The C++ Standards Committee, P0147R0, 2015.
|
||||
|
||||
[#P0166_anchor] [P0166] J. D. Garcia. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0166r0.pdf /Three interesting questions about contracts/]. The C++ Standards Committee, P0166R0, 2015.
|
||||
|
||||
[#P0246_anchor] [P0246] N. Myers. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0246r0.pdf /Criteria for Contract Support Merged Proposal/]. The C++ Standards Committee, P0246R0, 2016.
|
||||
|
||||
[#P0287_anchor] [P0287] G. Dos Reis, J.D. Garcia, F. Logozzo, M. Fahndrich, S. Lahiri. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0287r0.pdf /Simple Contracts for C++ (R1)/]. The C++ Standards Committee, P0287R0, 2016.
|
||||
|
||||
[#P0380_anchor] [P0380] G. Dos Reis, J.D. Garcia, J. Lakos, A. Meredith, N. Myers, and B. Stroustrup. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0380r1.pdf /A Contract Design/]. The C++ Standards Committee, P0380R1, 2016.
|
||||
|
||||
[#P0542_anchor] [P0542] G. Dos Reis, J.D. Garcia, J. Lakos, A. Meredith, N. Myers, and B. Stroustrup. [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0542r0.html /Support for contract based programming in C++/]. The C++ Standards Committee, P0542R0, 2017.
|
||||
|
||||
[#Rosenblum95_anchor] [Rosenblum95] D. S. Rosenblum. [@http://www.cs.toronto.edu/~chechik/courses06/csc410/rosenblum_assert95.pdf /A practical Approach to Programming With Assertions/]. IEEE Transactions on Software Engineering, 1995.
|
||||
|
||||
[#SPARKAda_anchor] [SPARKAda] Praxis. [@http://www.praxis-his.com/sparkada/language.asp /SPARKAda (Ada-like Language with Contract Programming)/].
|
||||
|
||||
[#SpecSharp_anchor] [SpecSharp] Microsoft. [@http:://research.microsoft.com/en-us/projects/specsharp/ /Spec# (C# Extension)/].
|
||||
|
||||
[#Stroustrup94_anchor] [Stroustrup94] B. Stroustrup. /The Design and Evolution of C++/. Addison Wesley, 1994.
|
||||
|
||||
[#Stroustrup13_anchor] [Stroustrup13] B. Stroustrup. /The C++ Programming Language/. Addison Wesley, 4th Edition, 2013.
|
||||
|
||||
[#Tandin04_anchor] [Tandin04] A. Tandin. [@http://www.codeproject.com/KB/macros/DbC_and_Doxygen.aspx /Design by Contract macros for C++ and link to Doxygen/]. 2004.
|
||||
|
||||
[#Wilson06_anchor] [Wilson06] M. Wilson. [@http://www.artima.com/cppsource/deepspace.html /Contract Programming 101 - The Nuclear Reactor and the Deep Space Probe/]. The C++ Source, 2006.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,679 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Contract Programming Overview]
|
||||
|
||||
[:['["It is absurd to make elaborate security checks on debugging runs, when no trust is put in the results, and then remove them in production runs, when an erroneous result could be expensive or disastrous. What would we think of a sailing enthusiast who wears his life-jacket when training on dry land but takes it off as soon as he goes to sea?]]]
|
||||
[:['-- Charles Antony Richard Hoare (see __Hoare73__)]]
|
||||
|
||||
This section gives an overview of Contract Programming (see __Meyer97__, __Mitchell02__, and __N1613__ for more detailed introductions to Contract Programming).
|
||||
Readers that already have a basic understanding of Contract Programming can skip this section and maybe come back to it after reading the __Tutorial__.
|
||||
|
||||
[note
|
||||
The objective of this library is not to convince programmers to use Contract Programming.
|
||||
It is assumed that programmes understand the benefits and trade-offs associated with Contract Programming and they have already decided to use this methodology in their code.
|
||||
Then, this library aims to be the best and more complete Contract Programming library for C++ (that does not use preprocessors and other tools external to the C++ preprocessor and language itself).
|
||||
]
|
||||
|
||||
[section Assertions]
|
||||
|
||||
Contract Programming is characterized by the following assertion mechanisms:
|
||||
|
||||
* /Preconditions/: These are logical conditions that programmers expect to be true when a function is called (e.g., to check constraints on function arguments).
|
||||
Operations that logically have no preconditions (i.e., that are always well-defined for the entire domain of their inputs) are often referred to as having a /wide contract/.
|
||||
This is in contrast to operations that have preconditions which are often referred to as having a /narrow contract/ (note that operations with truly narrow contracts should not even throw exceptions).
|
||||
[footnote
|
||||
The nomenclature of wide and narrow contracts has gained some popularity in recent years in the C++ community (appearing in a number of more recent proposals to add contract programming to the C++ standard, see __Bibliography__).
|
||||
This nomenclature is perfectly reasonable but it is not often used in this document because the authors generally prefer to explicit mention "this operation has no preconditions..." or "this operation has preconditions...".
|
||||
]
|
||||
* /Postconditions/: These are logical conditions that programmers expect to be true when a function exits without throwing an exception (e.g., to check the result and any side effect that a function might have).
|
||||
Postconditions can access the function return value (for non-void functions) and /old values/ that expressions had before the function body was executed.
|
||||
* /Exception guarantees/: These are logical conditions that programmers except to be true when a function exits throwing an exception.
|
||||
Exceptions specifications can access old values (but not the function return value).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Contract assertions for exception guarantees were first introduced by this library (even if exception safety guarantees have long been part of C++ STL documentation).
|
||||
Contract assertions for exception safety guarantees are not part of __N1962__ or other references listed in the __Bibliography__.
|
||||
]
|
||||
* /Class invariants/: These are logical conditions that programmers expect to be true after a constructor exits without throwing an exception, before and after the execution of every non-static public non-static function (even if they throw exceptions), before the destructor is executed and if the destructor throws an exception (i.e., class invariants define valid states for all objects of a given class).
|
||||
It is possible to specify a different set of class invariants for volatile public functions, namely /volatile class invariants/.
|
||||
It is also possible to specify /static class invariants/ which are excepted to be true before and after the execution of any constructor, destructor (even if it does not throw an exception), and public function (even if static).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Static and volatile class invariants were first introduced by this library to reflect the fact that C++ supports both static and volatile public functions.
|
||||
Static and volatile class invariants are not part of __N1962__ or other references listed in the __Bibliography__.
|
||||
]
|
||||
* /Subcontracting/: This indicates that preconditions cannot be strengthen, while postconditions and class invariants cannot be weaken when a public function in a derived class overrides public functions in one or more of its base classes (this is formally defined according to the __substitution_principle__).
|
||||
|
||||
Class invariants can also be used to specify /basic/ exception safety guarantees for an object (because they are checked at exit of public functions even when those throw an exception), while contract assertions for exception guarantees can be used to specify /strong/ exception safety guarantees for given operations on the same object.
|
||||
|
||||
It is also a common requirement for Contract Programming to automatically disable contract checking while already checking assertions from another contract (in order to avoid infinite recursion while checking contract assertions).
|
||||
|
||||
[note
|
||||
This library implements this requirement but in order to globally disable assertions while checking another assertion some kind of global arbitrating variable needs to be used by this library implementation.
|
||||
This library will automatically protect such a global variable from race conditions in multi-threated programs, but this will effectively introduce a global lock in the program (the [macroref BOOST_CONTRACT_DISABLE_THREADS] macro can be defined to disable this global lock but at the risk of incurring in race conditions).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
[macroref BOOST_CONTRACT_DISABLE_THREADS] is named after `BOOST_DISABLE_THREADS`.
|
||||
]
|
||||
]
|
||||
|
||||
In general, it is recommended to specify different contract conditions using separate assertion statements and not to group them together into a single condition using logical operators (`&&`, `||`, etc.).
|
||||
This is because when contract conditions are programmed together in a single assertion using logical operators, it is not be clear which condition actually failed in case the entire assertion fails at run-time.
|
||||
|
||||
[heading C-Style Assertions]
|
||||
|
||||
A limited form of Contract Programming is the use of the C-style `assert` macro.
|
||||
Using `assert` is common practice for many programmers but it suffers of the following limitations:
|
||||
|
||||
* `assert` does not distinguish between preconditions and postconditions.
|
||||
In well-tested production code, postconditions can usually be disabled trusting the correctness of the implementation while preconditions might still need to remain enabled because of possible changes in the calling code (e.g., postconditions of a given library could be disabled after testing while its preconditions can be kept enabled given the library cannot predict the evolution of user code that will be calling it).
|
||||
Using `assert` it is not possible to selectively disable only postconditions and all assertions must be disabled at once.
|
||||
* `assert` requires to manually program extra code to check class invariants (extra member functions, try blocks, etc.).
|
||||
* `assert` does not support subcontracting.
|
||||
* `assert` calls are usually scattered within function implementations thus the asserted conditions are not immediately visible in their entirety by programmers (as they are instead when the assertions appear in the function declaration or at least at the very top of function definition).
|
||||
|
||||
Contract Programming does not suffers of these limitations.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Benefits and Costs]
|
||||
|
||||
[heading Benefits]
|
||||
|
||||
The main use of Contract Programming is to improve software quality.
|
||||
__Meyer97__ discusses how Contract Programming can be used as the basic tool to write ["correct] software.
|
||||
__Stroustrup94__ discusses the key importance of class invariants plus advantages and disadvantages of preconditions and postconditions.
|
||||
The following is a short summary of the benefits associated with Contract Programming inspired mainly by __N1613__:
|
||||
|
||||
* Preconditions and postconditions:
|
||||
Using function preconditions and postconditions, programmers can give a precise semantic description of what a function requires at its entry and what it ensures at its exit (if it does not throw an exception).
|
||||
In particular, using postcondition old values, Contract Programming provides a mechanism that allows programmers to compare values of an expression before and after the function body execution.
|
||||
This mechanism is powerful enough to enable programmers to express many correctness constraints within the code itself, constraints that would otherwise have to be captured at best only informally by documentation.
|
||||
* Class invariants:
|
||||
Using class invariants, programmers can describe what to expect from a class and the logic dependencies between the class members.
|
||||
It is the job of the constructor to ensure that the class invariants are satisfied when the object is first created.
|
||||
Then the implementation of the member functions can be largely simplified as they can be written knowing that the class invariants are satisfied because Contract Programing checks them before and after the execution of every public function.
|
||||
Finally, the destructor makes sure that the class invariants held for the entire life of the object checking the class invariants one last time before the object is destructed.
|
||||
Class invariants can also be used as a criterion for good abstraction: If it is not possible to specify an invariant, it might be an indication that the design abstraction maybe be poor and it should not have been made into a class.
|
||||
* Self-documenting code:
|
||||
Contracts are part of the source code, they are checked at run-time so they are always up-to-date with the code itself.
|
||||
Therefore program specifications, as documented by the contracts, can be trusted to always be up-to-date with the implementation.
|
||||
* Easier debugging:
|
||||
Contract Programming can provide a powerful debugging facility because, if contracts are well written, bugs will cause contract assertions to fail exactly where the problem first occurs instead than at some later stage of the program execution in an apparently unrelated (and often hard to debug) manner.
|
||||
Note that a precondition failure points to a bug in the function caller, a postcondition failure points instead to a bug in the function implementation.
|
||||
[footnote
|
||||
Of course, if contracts are ill-written then Contract Programming is of little use.
|
||||
However, it is less likely to have a bug in both the function body and the contract than in the function body only.
|
||||
For example, consider the validation of a result in postconditions.
|
||||
Validating the return value might seem redundant, but in this case we actually want that redundancy.
|
||||
When programmers write a function, there is a certain probability that they make a mistake in implementing the function body.
|
||||
When programmers specify the result of the function in the postconditions, there is also a certain probability that they make a mistake in writing the contract.
|
||||
However, the probability that programmers make a mistake twice (in both the body /and/ the contract) is in general lower than the probability that the mistake is made just once (in either the body or the contract).
|
||||
]
|
||||
* Easier testing:
|
||||
Contract Programming facilitates testing because a contract naturally specifies what a test should check.
|
||||
For example, preconditions of a function state which inputs cause the function to fail and postconditions state which outputs are produced by the function on successful exit (Contract Programming should be seen as a tool to complement, but obviously not to replace, testing).
|
||||
* Formal design:
|
||||
Contract Programming can serve to reduce the gap between designers and programmers by providing a precise and unambiguous specification language in terms of the contract assertions.
|
||||
Moreover, contracts can make code reviews easier by clarifying some of the semantics and usage of the code.
|
||||
* Formalized inheritance:
|
||||
Contract Programming formalizes the virtual function overriding mechanism using subcontracting as justified by the __substitution_principle__.
|
||||
This keeps the base class programmers in control as overriding functions always have to fully satisfy the contracts of their base classes.
|
||||
* Replace Defensive Programming:
|
||||
Contract Programming assertions can replace [@http://en.wikipedia.org/wiki/Defensive_programming Defensive Programming] checks localizing these checks within the contract and making the code more readable.
|
||||
|
||||
Of course, not all formal contract specifications can be asserted in C++.
|
||||
For example, in C++ is it not possible to assert the validity of an iterator range in the general case because the only way to check if two iterators form a valid range is to keep incrementing the first iterator until we reach the second iterator.
|
||||
However, in case the iterator range is invalid, such a code would render undefined behaviour or run forever instead of failing an assertion.
|
||||
Nevertheless, a large amount of contract assertions can be successfully programmed in C++ as illustrated by the numerous examples in this documentation and from the literature (for example see how much of STL [link N1962_vector_anchor `vector`] contract assertions can actually be programmed in C++ using this library).
|
||||
|
||||
[heading Costs]
|
||||
|
||||
In general, Contract Programming benefits come at the cost of performance as discussed in detail by both __Stroustrup94__ and __Meyer97__.
|
||||
While performance trade-offs should be carefully considered depending on the specific application domain, software quality cannot be sacrificed: It is difficult to see value in software that quickly and efficiently provides incorrect results.
|
||||
|
||||
The run-time performances are negatively impacted by Contract Programming mainly because of extra time require to:
|
||||
|
||||
* Check the asserted conditions.
|
||||
* Copy old values when these are used in postconditions and exception guarantees.
|
||||
* Call additional functors that check preconditions, postconditions, exception guarantees, class invariants, etc. (especially for subcontracting).
|
||||
|
||||
[note
|
||||
In general, contracts introduce at least three extra functor calls to check preconditions, postconditions, and exception guarantees for any given non-member function call.
|
||||
Public functions introduce also two more function calls to check class invariants (at entry and at exit).
|
||||
For subcontracting, these extra calls (some of which become virtual calls) are repeated for the number of functions being overridden from the base classes (possibly deep in the inheritance tree).
|
||||
In addition to that, this library introduces a number of function calls internal to its implementation in order to properly check the contracts.
|
||||
]
|
||||
|
||||
To mitigate the run-time performance impact, programmers can selectively disable run-time checking of some of the contract assertions.
|
||||
Programmers will have to decide based on the performance trade-offs required by their applications, but a reasonable approach often is to (see __Disable_Contract_Checking__):
|
||||
|
||||
* Always write contracts to clarify the semantics of the design embedding the specifications directly in the code and making the code self-documenting.
|
||||
* Check preconditions, postconditions, class invariants, and maybe even exception guarantees during initial testing.
|
||||
* Only check preconditions (and maybe class invariants, but not postconditions and exception guarantees) during release testing and for the final release.
|
||||
|
||||
This approach is usually reasonable because in well-tested production code, validating the function body implementation using postconditions is rarely needed since the function has shown itself to be ["correct] during testing.
|
||||
On the other hand, checking function arguments using preconditions is always needed because of changes that can be made to the calling code (without having to necessarily re-test and re-release the called code).
|
||||
Furthermore, postconditions and also exception guarantees, with related old value copies, are often computationally more expensive to check than preconditions and even class invariants.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Function Calls]
|
||||
|
||||
[heading Non-Member Functions]
|
||||
|
||||
A call to a non-member function with a contract executes the following steps (see [funcref boost::contract::function]):
|
||||
|
||||
# Check function preconditions.
|
||||
# Execute the function body.
|
||||
# If the body did not throw an exception, check function postconditions.
|
||||
# Else, check function exception guarantees.
|
||||
|
||||
[heading Private and Protected Functions]
|
||||
|
||||
In Contract Programming, private and protected functions do not have to satisfy the class invariants because these functions are part of the class implementation and not of the class public interface.
|
||||
Furthermore, the __substitution_principle__ does not apply to private and protected functions because these functions are not accessible to the user at the calling site where the __substitution_principle__ applies.
|
||||
|
||||
Therefore, calls to private and protected functions with contracts execute the same steps as the ones indicated above for non-member functions (checking only preconditions and postconditions, but without checking class invariants and without subcontracting).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Public Function Calls]
|
||||
|
||||
[heading Overriding Public Functions]
|
||||
|
||||
Let's consider a public function in a derived class that overrides public virtual functions declared in a number of its public base classes (because of C++ multiple inheritance, the function could override from more than one base class).
|
||||
We refer to the function in the derived class as the /overriding function/, and to the set of base classes containing all the /overridden functions/ as /overridden bases/.
|
||||
|
||||
When subcontracting, overridden functions are searched (at compile-time) deeply in the public branches of the inheritance tree (i.e., not just the derived class's direct public parents are inspected, but also all its public grandparents, etc.).
|
||||
In case of multiple inheritance this search also extends widely to all multiple public base classes following their order of declaration in the derived class inheritance list (as usual in C++, this search could result in multiple overridden functions and therefore in subcontracting from multiple public base classes).
|
||||
Note that only public base classes are considered for subcontracting because private and protected base classes are not accessible to the user at the calling site where the __substitution_principle__ applies.
|
||||
|
||||
A call to the overriding public function with a contract executes the following steps (see [funcref boost::contract::public_function]):
|
||||
|
||||
# Check static class invariants __AND__ non-static class invariants for all overridden bases, __AND__ then check the derived class static __AND__ non-static invariants.
|
||||
# Check preconditions of overridden public functions from all overridden bases in __OR__ with each other, __OR__ else check the overriding function preconditions in the derived class.
|
||||
# Execute the overriding function body.
|
||||
# Check static class invariants __AND__ non-static class invariants for all overridden bases, __AND__ then check the derived class static __AND__ non-static invariants (even if the body threw an exception).
|
||||
# If the body did not throw an exception, check postconditions of overridden public functions from all overridden bases in __AND__ with each other, __AND__ then check the overriding function postconditions in the derived class.
|
||||
# Else, check exception guarantees of overridden public functions from all overridden bases in __AND__ with each other, __AND__ then check the overriding function exception guarantees in the derived class.
|
||||
|
||||
Volatile public functions check static class invariants __AND__ /volatile/ class invariants instead.
|
||||
Preconditions and postconditions of volatile public functions and volatile class invariants access the object as `volatile`.
|
||||
|
||||
Class invariants are checked before preconditions and postconditions so programming precondition and postcondition assertions can be simplified assuming that class invariants are satisfied already (e.g., if class invariants assert that a pointer cannot be null then preconditions and postconditions can safety dereference that pointer without additional checking).
|
||||
Similarly, subcontracting checks contracts of public base classes before checking the derived class contracts so programming derived class contract assertions can be simplified by assuming that public base class contracts are satisfied already.
|
||||
|
||||
[note
|
||||
[#and_anchor] [#or_anchor]
|
||||
In this documentation __AND__ and __OR__ indicate the logic /and/ and /or/ operations evaluated in /short-circuit/.
|
||||
For example: `p` __AND__ `q` is true if and only if both `p` and `q` are true, but `q` is never evaluated when `p` is false; `p` __OR__ `q` is true if and only if either `p` or `q` are true, but `q` is never evaluated when `p` is true.
|
||||
|
||||
As indicated by the steps above and in accordance with the __substitution_principle__, subcontracting checks preconditions in __OR__ while class invariants, postconditions, and exceptions guarantees in __AND__ with preconditions, class invariants, postconditions, and exceptions guarantees of base classes.
|
||||
]
|
||||
|
||||
[heading Non-Overriding Public Functions]
|
||||
|
||||
A call to a non-static public function with a contract (that does not override functions from any of the public base classes) executes the following steps (see [funcref boost::contract::public_function]):
|
||||
|
||||
# Check class static __AND__ non-static invariants (but none of the invariants from base classes).
|
||||
# Check function preconditions (but none of the preconditions from functions in base classes).
|
||||
# Execute the function body.
|
||||
# Check the class static __AND__ non-static invariants (even if the body threw an exception, but none of the invariants from base classes).
|
||||
# If the body did not throw an exception, check function postconditions (but none of the postconditions from functions in base classes).
|
||||
# Else, check function exception guarantees (but none of the exception guarantees from functions in base classes).
|
||||
|
||||
Volatile public functions check static class invariants __AND__ /volatile/ class invariants instead.
|
||||
Preconditions and postconditions of volatile functions and volatile class invariants access the object as `volatile`.
|
||||
|
||||
Class invariants are checked because this function is part of the class public interface.
|
||||
However, none of the contracts of the base classes are checked because this function does not override any functions from any of the public base classes (so the __substitution_principle__ does not require to subcontract in this case).
|
||||
|
||||
[heading Static Public Functions]
|
||||
|
||||
A call to a static public function with a contract executes the following steps (see [funcref boost::contract::public_function]):
|
||||
|
||||
# Check static class invariants (but not the non-static invariants and none of the invariants from base classes).
|
||||
# Check function preconditions (but none of the preconditions from function in base classes).
|
||||
# Execute the function body.
|
||||
# Check static class invariants (even if the body threw an exception, but not the non-static invariants and none of the invariants from base classes).
|
||||
# If the body did not throw an exception, check function postconditions (but none of the postconditions from functions in base classes).
|
||||
# Else, check function exception guarantees (but none of the exception guarantees from functions in base classes).
|
||||
|
||||
Class invariants are checked because this function is part of the class public interface, but only static class invariants can be checked (because this is a static function so it cannot access the object that would instead be required to check non-static class invariants, volatile or not).
|
||||
Furthermore, static functions cannot override any function so the __substitution_principle__ does not apply and they do not subcontract.
|
||||
|
||||
Preconditions and postconditions of static functions and static class invariants cannot access the object (because they are checked from `static` member functions).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Constructor Calls]
|
||||
|
||||
A call to a constructor with a contract executes the following steps (see [classref boost::contract::constructor_precondition] and [funcref boost::contract::constructor]):
|
||||
|
||||
# Check constructor preconditions (but these cannot access the object because the object is not constructed yet).
|
||||
# Execute the constructor member initialization list (if present).
|
||||
# Construct any base class (public or not) according with C++ construction mechanism and also check the contracts of these base constructors (according with steps similar to the ones listed here).
|
||||
# Check static class invariants (but not the non-static or volatile class invariants, because the object is not constructed yet).
|
||||
# Execute the constructor body.
|
||||
# Check static class invariants (even if the body threw an exception).
|
||||
# If the body did not throw an exception:
|
||||
# Check non-static __AND__ volatile class invariants (because the object is now successfully constructed).
|
||||
# Check constructor postconditions (but these cannot access the object old value [^['oldof]]`(*this)` because there was no object before the execution of the constructor body).
|
||||
# Else, check constructor exception guarantees (but these cannot access the object old value [^['oldof]]`(*this)` because there was no object before the execution of the constructor body, plus they can only access class static members because the object was not successfully constructed upon the constructor body throwing an exception).
|
||||
|
||||
Constructor preconditions are checked before executing the member initialization list so programming these initializations can be simplified assuming the constructor preconditions are satisfied (e.g., constructor arguments can be validated by the constructor preconditions before they are used to initialize base classes and data members).
|
||||
|
||||
As indicated in step 2.a. above, C++ object construction mechanism will automatically check base class contracts when these bases are initialized (no explicit subcontracting behaviour is required here).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Destructor Calls]
|
||||
|
||||
A call to a destructor with a contract executes the following steps (see [funcref boost::contract::destructor]):
|
||||
|
||||
# Check static class invariants __AND__ non-static __AND__ volatile class invariants.
|
||||
# Execute the destructor body (destructors have no parameters and they can be called at any time after object construction so they have no preconditions).
|
||||
# Check static class invariants (even if the body threw an exception).
|
||||
# If the body did not throw an exception:
|
||||
# Check destructor postconditions (but these can only access class static members and the object old value [^['oldof]]`(*this)` because there is no object after successful execution of the destructor body).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Postconditions for destructors are not part of __N1962__ or other references listed in the __Bibliography__ (but with respect to __Meyer97__ it should be noted that Eiffel does not support static data members and that might by why destructors do not have postconditions in Eiffel).
|
||||
However, in principle there could be uses for destructor postconditions so this library supports postconditions for destructors (e.g., a class that counts object instances could use destructor postconditions to assert that an instance counter stored in a static data member is decreased by `1` because the object has been destructed).
|
||||
]
|
||||
# Destroy any base class (public or not) according with C++ destruction mechanism and also check the contracts of these base destructors (according with steps similar to the ones listed here).
|
||||
# Else (even if destructors should rarely, if ever, be allowed to throw exceptions in C++):
|
||||
# Check non-static class invariants (because the object was not successfully destructed so it still exists and should satisfy its invariants).
|
||||
# Check destructor exception guarantees.
|
||||
|
||||
As indicated in step 4.b. above, C++ object destruction mechanism will automatically check base class contracts when the destructor exits without throwing an exception (no explicit subcontracting behaviour is required here).
|
||||
|
||||
[note
|
||||
Given that C++ allows destructors to throw, this library handles the case when the destructor body throws an exception as indicated above.
|
||||
However, in order to comply with STL exception safety guarantees and good C++ programming practices, programmers should implement destructor bodies to rarely, if ever, throw exceptions (in fact destructors are declared `noexcept` by default in C++11).
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Constant-Correctness]
|
||||
|
||||
Contracts should not be allowed to modify the program state because they are only responsible to check (and not to change) the program state in order to verify its compliance with the specifications.
|
||||
Therefore, contracts should only have access to the object, function arguments, function return value, old values, and all other program variables in `const` context (via `const&`, `const* const`, `const volatile`, etc.).
|
||||
|
||||
Whenever possible (e.g., class invariants and postcondition old values), this library automatically enforces this constant-correctness constraint at compile-time using `const`.
|
||||
However, this library cannot automatically enforce this constraint in all cases (for preconditions and postconditions of mutable member functions, for global variables, etc.).
|
||||
See __No_Lambda_Functions__ for ways of using this library that always and automatically enforce the constant-correctness constraint at compile-time (but these methods require a significant amount of boiler-plate code to be programmed manually so they are not recommended in general).
|
||||
|
||||
[important
|
||||
In general, it is the responsibility of the programmers to code assertions that only check, and do not change, program variables.
|
||||
[footnote
|
||||
Note that also when using C-style `assert` it is the responsibility of the programmers to code assertions that only check and do not change program variables.
|
||||
]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Specification vs. Implementation]
|
||||
|
||||
Contracts are part of the program specification and not of its implementation.
|
||||
Therefore, contracts should ideally be programmed within C++ declarations, and not within definitions.
|
||||
|
||||
In general, this library cannot satisfy this requirement.
|
||||
However, even when the contracts are programmed together with the body in the function definition, it is still very easy for users to identify and read just the contract portion of the function definition (because the contract code must always be programmed at the very top of the function definition).
|
||||
See __Separate_Body_Implementation__ for ways of using this library to program contract specifications outside of the body implementation but at the cost of writing one extra function for any given function (for applications were this requirement is truly important).
|
||||
|
||||
Furthermore, contracts are most useful when they assert conditions only using public members (in most cases, the need for using non-public members to check contracts, especially in preconditions, indicates an error in the class design).
|
||||
For example, the caller of a public function cannot in general make sure that the function preconditions are satisfied if the precondition assertions use private members that are not callable by the caller (therefore, a failure in the preconditions will not necessarily indicate a bug in the caller given that the caller was made unable to fully check the preconditions in the first place).
|
||||
|
||||
However, given that C++ provides programmers ways around access level restrictions (`friend`, function pointers, etc.), this library leaves it up to the programmers to make sure that only public members are used in contract assertions (especially in preconditions). (__N1962__ follows the same approach not restricting contracts to only use public members, Eiffel instead generates a compile-time error if preconditions are asserted using non-public members.)
|
||||
[footnote
|
||||
*Rationale:*
|
||||
If C++ [@http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#45 defect 45] had not been fixed, this library could have been implemented so to generate a compile-time error when precondition assertions use non-public members more similarly to Eiffel's implementation (but not necessary the best approach for C++).
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section On Contract Failure]
|
||||
|
||||
If precondition, postcondition, exception guarantee, or class invariant assertions are either checked to be false or their evaluation throws an exception at run-time then this library will call specific /failure handler functions/.
|
||||
|
||||
By default, these failure handler functions print a message to the standard error `std::cerr` (with detailed information about the failure) and then terminate the program calling `std::terminate`.
|
||||
However, using [funcref boost::contract::set_precondition_failure], [funcref boost::contract::set_postcondition_failure], [funcref boost::contract::set_except_failure], [funcref boost::contract::set_invariant_failure], etc. programmers can define their own failure handler functions that can take any user-specified action (throw an exception, exit the program with an error code, etc., see __Throw_on_Failure__).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
This customizable failure handling mechanism is similar to the one used by C++ `std::terminate` and also to the one proposed in __N1962__.
|
||||
]
|
||||
|
||||
[note
|
||||
In C++ there are a number of issues with programming contract failure handlers that throw exceptions instead of terminating the program.
|
||||
Specifically, destructors check class invariants so they will throw if programmers change class invariant failure handlers to throw instead of terminating the program, but in general destructors should not throw in C++ (to comply with STL exception safety, etc.).
|
||||
Furthermore, programming an exception guarantee failure handler to throw will throw an exception (the one reporting the contract failure) while there is already an active exception (the one that caused the exception guarantees to be checked in the first place), and this will force C++ to terminate the program anyway.
|
||||
]
|
||||
|
||||
Therefore, it is recommended to terminate the program at least for contract failures from destructors and exception guarantees (if not in all other cases of contract failures as it is done by default by this library).
|
||||
The contract failure handler functions programmed using this library have information about the failed contract (preconditions, postconditions, etc.) and the operation that was checking the contract (constructor, destructor, etc.) so programmers can granularly distinguish all cases and decide when it is appropriate to terminate, throw, or take some other user-specific action.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Feature Summary]
|
||||
|
||||
The Contract Programming features supported by this library are largely based on __N1962__ and on the Eiffel programming language.
|
||||
The following table compares Contract Programming features among this library, __N1962__ (unfortunately the C++ standard committee rejected this proposal commenting on a general lack of need for adding Contract Programming to C++ at the time, even if __N1962__ itself is sound), a more recent proposal __P0380__ (which unfortunately only supports preconditions and postconditions, but does not support class invariants, old values, and subcontracting), the Eiffel and D programming languages:
|
||||
|
||||
[table
|
||||
[
|
||||
[Feature]
|
||||
[This Library]
|
||||
[__N1962__ Proposal (not accepted in C++)]
|
||||
[__P0380__ Proposal (being considered for C++2x)]
|
||||
[ISE Eiffel 5.4 (see __Meyer97__)]
|
||||
[D (see __Bright04__)]
|
||||
][
|
||||
[['Keywords and specifiers]]
|
||||
[
|
||||
Specifiers: `precondition`, `postcondition`, `invariant`, `static_invariant`, and `base_types`.
|
||||
The last three specifiers appear in user code so their names can be referred to or changed using [macroref BOOST_CONTRACT_INVARIANT], [macroref BOOST_CONTRACT_STATIC_INVARIANT], and [macroref BOOST_CONTRACT_BASES_TYPEDEF] macros respectively to avoid name clashes.
|
||||
]
|
||||
[Keywords: `precondition`, `postcondition`, `oldof`, and `invariant`.]
|
||||
[Attributes: `[[expects]]` and `[[ensures]]`.]
|
||||
[Keywords: =require=, =require else=, =ensure=, =ensure then=, =old=, =result=, =do=, and =invariant=.]
|
||||
[Keywords: =in=, =out=, =assert=, and =invariant=.]
|
||||
][
|
||||
[['On contract failure]]
|
||||
[Print an error to `std::cerr` and call `std::terminate` (but can be customized to throw exceptions, exit with an error code, etc.).]
|
||||
[Call `std::terminate` (but can be customized to throw exceptions, exit with an error code, etc.).]
|
||||
[Call `std::abort` (but can be customized to throw exceptions, exit with an error code, etc.).]
|
||||
[Throw exceptions.]
|
||||
[Throw exceptions.]
|
||||
][
|
||||
[['Result value in postconditions]]
|
||||
[Yes, captured by or passed as a parameter to (for virtual functions) the postcondition functor.]
|
||||
[Yes, `postcondition(`[^['result-variable-name]]`)`.]
|
||||
[Yes, `[[ensures `[^['result-variable-name]]`: ...]]`.]
|
||||
[Yes, =result= keyword.]
|
||||
[No.]
|
||||
][
|
||||
[['Old values in postconditions]]
|
||||
[
|
||||
Yes, [macroref BOOST_CONTRACT_OLD] macro and [classref boost::contract::old_ptr] (but copied before preconditions unless `.old(...)` is used as shown in __Old_Copies_at_Body__).
|
||||
For templates, [classref boost::contract::old_ptr_if_copyable] skips old value copies for non-copyable types and [funcref boost::contract::condition_if] skips old value copies selectively based on old expression type requirements.
|
||||
]
|
||||
[
|
||||
Yes, `oldof` keyword (copied after preconditions and before body).
|
||||
(Never skipped, not even in templates for non-copyable types.)
|
||||
]
|
||||
[No.]
|
||||
[
|
||||
Yes, =old= keyword (copied after preconditions and before body).
|
||||
(Never skipped, but all types are copyable in Eiffel.)
|
||||
]
|
||||
[No.]
|
||||
][
|
||||
[['Class invariants]]
|
||||
[
|
||||
Checked at constructor exit, at destructor entry and throw, and at public function entry, exit, and throw.
|
||||
Same for volatile class invariants.
|
||||
Static class invariants checked at entry and exit of constructor, destructor, and any (also `static`) public function.
|
||||
]
|
||||
[
|
||||
Checked at constructor exit, at destructor entry and throw, and at public function entry, exit, and throw.
|
||||
(Volatile and static class invariants not supported.)
|
||||
]
|
||||
[No.]
|
||||
[
|
||||
Checked at constructor exit, and around public functions.
|
||||
(Volatile and static class invariants do not apply to Eiffel.)
|
||||
]
|
||||
[
|
||||
Checked at constructor exit, at destructor entry, and around public functions.
|
||||
(Volatile and static class invariants not supported, `volatile` was deprecated all together in D.)
|
||||
]
|
||||
][
|
||||
[['Subcontracting]]
|
||||
[
|
||||
Yes, also supports subcontracting for multiple inheritance ([macroref BOOST_CONTRACT_BASE_TYPES], [macroref BOOST_CONTRACT_OVERRIDE], and [classref boost::contract::virtual_] are used for declaring base classes, overriding and virtual public functions respectively).
|
||||
]
|
||||
[
|
||||
Yes, also supports subcontracting for multiple inheritance but only preconditions only in base classes.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
The authors of __N1962__ decided to forbid derived classes from subcontracting preconditions because they found that such a feature was rarely, if evet, used (see [@http://lists.boost.org/Archives/boost/2010/04/164862.php Re: \[boost\] \[contract\] diff n1962]).
|
||||
Still, it should be noted that even in __N1962__ if a derived class overrides two functions with preconditions coming from two different base classes via multiple inheritance, the overriding function contract will check preconditions from its two base class functions in __OR__ (so even in __N1962__ preconditions can indirectly subcontract when multiple inheritance is used).
|
||||
The authors of this library found that confusing about __N1962__.
|
||||
Furthermore, subcontracting preconditions is soundly defined by the __substitution_principle__ so this library allows to subcontract preconditions as Eiffel does (users can always avoid using this feature if they have no need for it).
|
||||
(This is essentially the only feature for which this library deliberately differ from __N1962__.)
|
||||
]
|
||||
]
|
||||
[No.]
|
||||
[Yes.]
|
||||
[Yes.]
|
||||
][
|
||||
[['Contracts for pure virtual functions]]
|
||||
[Yes (but they must be programmed in out-of-line functions as always in C++ with pure virtual function definitions).]
|
||||
[Yes.]
|
||||
[No (because no subcontracting).]
|
||||
[Yes (contracts for abstract functions).]
|
||||
[No (but planned).]
|
||||
][
|
||||
[['Arbitrary code in contracts]]
|
||||
[Yes (but users are generally recommended to only program assertions using [macroref BOOST_CONTRACT_ASSERT] and if-guard statements within contracts to avoid introducing bugs and expensive code in contracts, and also to only use public functions to program preconditions).]
|
||||
[No, assertions only.]
|
||||
[No, assertions only. In addition only public members can be used in preconditions.]
|
||||
[No, assertions only. In addition only public members can be used in preconditions.]
|
||||
[Yes.]
|
||||
][
|
||||
[['Constant-correctness]]
|
||||
[Enforced only for class invariants and old values (making also preconditions and postconditions constant-correct is possible but requires users to program a fare amount of boiler-plate code).]
|
||||
[Yes.]
|
||||
[Yes.]
|
||||
[Yes.]
|
||||
[No.]
|
||||
][
|
||||
[['Contracts in specifications or implementation]]
|
||||
[Implementation (unless programmers manually write an extra function for any given function).]
|
||||
[Specification (function declaration).]
|
||||
[Specification (function declaration).]
|
||||
[Specification.]
|
||||
[Specification.]
|
||||
][
|
||||
[['Function code ordering]]
|
||||
[Preconditions, postconditions, exception guarantees, body.]
|
||||
[Preconditions, postconditions, body.]
|
||||
[Preconditions, postconditions, body.]
|
||||
[Preconditions, body, postconditions.]
|
||||
[Preconditions, postconditions, body.]
|
||||
][
|
||||
[['Disable assertion checking within assertions checking (to avoid infinite recursion when checking contracts)]]
|
||||
[
|
||||
Yes, but use [macroref BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION] to disable no assertion while checking preconditions (see [macroref BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION]).
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Theoretically, it can be shown that an incorrect argument might be passed to the function body when assertion checking is disabled while checking preconditions (see [@http://lists.boost.org/Archives/boost/2010/04/164862.php Re: \[boost\] \[contract\] diff n1962]).
|
||||
Therefore, __N1962__ does not disable any assertion while checking preconditions.
|
||||
However, that makes it possible to have infinite recursion while checking preconditions, plus Eiffel disables assertion checking also while checking preconditions.
|
||||
Therefore, this library by default disables assertion checking also while checking preconditions, but it also provides the [macroref BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION] configuration macro so users can change this behaviour if needed.
|
||||
]
|
||||
(In multi-threaded programs this introduces a global lock, see [macroref BOOST_CONTRACT_DISABLE_THREADS].)
|
||||
]
|
||||
[Yes for class invariants and postconditions, but preconditions disable no assertion.]
|
||||
[No.]
|
||||
[Yes.]
|
||||
[No.]
|
||||
][
|
||||
[['Nested member function calls]]
|
||||
[
|
||||
Disable nothing.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Older versions of this library defined a data member in the user class that was automatically used to disable checking of class invariants within nested member function calls (similarly to Eiffel).
|
||||
This feature was also required by older revisions of __N1962__ but it is no longer required by __N1962__.
|
||||
Furthermore, in multi-threaded programs this feature would introduce a lock that synchronizes all member functions calls for a given object.
|
||||
Therefore, this feature was removed in the current revision of this library.
|
||||
]
|
||||
]
|
||||
[Disable nothing.]
|
||||
[Disable nothing.]
|
||||
[Disable all contract assertions.]
|
||||
[Disable nothing.]
|
||||
][
|
||||
[['Disable contract checking]]
|
||||
[Yes, contract checking can be skipped at run-time by defining combinations of the [macroref BOOST_CONTRACT_NO_PRECONDITIONS], [macroref BOOST_CONTRACT_NO_POSTCONDITIONS], [macroref BOOST_CONTRACT_NO_INVARIANTS], [macroref BOOST_CONTRACT_NO_ENTRY_INVARIANTS], and [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS] macros (completely removing contract code from compiled object code is possible but requires using macros shown in __Disable_Contract_Compilation__).]
|
||||
[Yes (contract code also removed from compiled object code, but details are compiler-implementation specific).]
|
||||
[Yes (contract code also removed from compiled object code, but details are compiler-implementation specific).]
|
||||
[Yes, but only predefined combinations of preconditions, postconditions, and class invariants can be disabled (contract code also removed from compiled object code).]
|
||||
[Yes.]
|
||||
][
|
||||
[['Assertion levels]]
|
||||
[Yes, predefined default, audit, and axiom plus programmers can define their own levels.]
|
||||
[No (but a previous revision of this proposal considered adding assertion levels called "assertion ordering").]
|
||||
[Yes, predefined default, audit, and axiom.]
|
||||
[No.]
|
||||
[No.]
|
||||
]
|
||||
]
|
||||
|
||||
The authors of this library also consulted the following references that implemented Contract Programming for C++ (but usually for only a limited set of features, or using preprocessing tools other than the C++ preprocessor and external to the language itself) or for languages other than C++ (see __Bibliography__ for a complete list of all the references consulted in the design and development of this library):
|
||||
|
||||
[table
|
||||
[ [Reference] [Language] [Notes] ]
|
||||
[ [__Bright04b__] [C++] [
|
||||
The Digital Mars C++ compiler extends C++ adding Contract Programming language support (among many other features).
|
||||
] ]
|
||||
[ [__Lindrud04__] [C++] [
|
||||
This supports class invariants and old values but it does not support subcontracting (contracts are specified within definitions instead of declarations and assertions are not constant-correct).
|
||||
] ]
|
||||
[ [__Tandin04__] [C++] [
|
||||
Interestingly, these contract macros automatically generate Doxygen documentation
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Older versions of this library also automatically generated Doxygen documentation from contract definition macros.
|
||||
This functionality was abandoned for a number of reasons: this library no longer uses macros to program contracts; even before that, the implementation of this library macros became too complex and the Doxygen preprocessor was no longer able to expand them; the Doxygen documentation was just a repeat of the contract code (so programmers could directly look at contracts in the source code); Doxygen might not necessarily be the documentation tool used by all C++ programmers.
|
||||
]
|
||||
but old values, class invariants, and subcontracting are not supported (plus contracts are specified within definitions instead of declarations and assertions are not constant-correct).
|
||||
] ]
|
||||
[ [__Maley99__] [C++] [
|
||||
This supports Contract Programming including subcontracting but with limitations (e.g., programmers need to manually build an inheritance tree using artificial template parameters), it does not use macros but programmers are required to write by hand a significant amount of boiler-plate code.
|
||||
(The authors have found this work very inspiring when developing initial revisions of this library especially for its attempt to support subcontracting.)
|
||||
] ]
|
||||
[ [__Nana__] [C++] [
|
||||
This uses macros but it only works on GCC (and maybe Clang, but it does not work on MSVC, etc.).
|
||||
It does not support subcontracting.
|
||||
It requires extra care to program postconditions for functions with multiple return statements.
|
||||
It seems that it might not check class invariants when functions throw exceptions (unless the `END` macro does that...).
|
||||
(In addition, it provides tools for logging and integration with GDB.)
|
||||
] ]
|
||||
[ [__C2__] [C++] [
|
||||
This uses an external preprocessing tool (the authors could no longer find this project's code to evaluate it).
|
||||
] ]
|
||||
[ [__iContract__] [Java] [
|
||||
This uses an external preprocessing tool.
|
||||
] ]
|
||||
[ [__Jcontract__] [Java] [
|
||||
This uses an external preprocessing tool.
|
||||
] ]
|
||||
[ [__CodeContracts__] [.NET] [
|
||||
Microsoft Contract Programming for .NET programming languages.
|
||||
] ]
|
||||
[ [__SpecSharp__] [C#] [
|
||||
This is a C# extension with Contract Programming language support.
|
||||
] ]
|
||||
[ [__Chrome__] [Object Pascal] [
|
||||
This is the .NET version of Object Pascal and it has language support for Contract Programming.
|
||||
] ]
|
||||
[ [__SPARKAda__] [Ada] [
|
||||
This is an Ada-like programming language with support for Contract Programming.
|
||||
] ]
|
||||
]
|
||||
|
||||
To the best knowledge of the authors, this the only library that fully supports all Contract Programming features for C++.
|
||||
Generally speaking:
|
||||
|
||||
* Implementing preconditions and postconditions in C++ is not difficult (e.g., using some kind of RAII object).
|
||||
* Implementing postcondition old values is also not too difficult usually requiring programmers to copy old values into local variables, but it is already somewhat more difficult to ensure such copies are not performed when postconditions are disabled.
|
||||
[footnote
|
||||
For example, the following emulation of old values based on __P0380__ never disables old value copies plus requires boiler-plate code to make sure postconditions are correctly checked in a `scope_exit` RAII object after all other local objects have been destroyed (because some of these destructors contribute to establishing the postconditions) and only if the function did not throw an exception:
|
||||
``
|
||||
void fswap(file& x, file& y)
|
||||
[[expects: x.closed()]]
|
||||
[[excepts: y.closed()]]
|
||||
// Postconditions in function definition below to emulate old values.
|
||||
{
|
||||
file old_x = x; // Emulate old values with local copies (not disabled).
|
||||
file old_y = y;
|
||||
scope_exit ensures([&] { // Check after local objects destroyed.
|
||||
if(!std::uncaught_exception()) { // Check only if no throw.
|
||||
[[assert: x.closed()]]
|
||||
[[assert: y.closed()]]
|
||||
[[assert: x == old_y]]
|
||||
[[assert: y == old_x]]
|
||||
}
|
||||
});
|
||||
|
||||
x.open();
|
||||
scope_exit close_x([&] { x.close(); });
|
||||
y.open();
|
||||
scope_exit close_y([&] { y.close(); });
|
||||
file t = file::temp();
|
||||
t.open;
|
||||
scope_exit close_t([&] { t.close(); });
|
||||
|
||||
x.mv(t);
|
||||
y.mv(x);
|
||||
t.mv(y);
|
||||
}
|
||||
``
|
||||
Here `scope_exit` is an RAII object that executes the nullary functor passed to its constructor when it is destroyed.
|
||||
]
|
||||
|
||||
* Implementing class invariants is more involved (especially if done automatically, without requiring programmers to manually invoke extra functions to check the invariants).
|
||||
[footnote
|
||||
For example, the following possible emulation of class invariants based on __P0380__ requires boiler-plate code to manually invoke the function that checks the invariants (note that invariants are checked at public function exit regardless of exceptions being thrown while postconditions are not):
|
||||
``
|
||||
template<typename T>
|
||||
class vector {
|
||||
bool invariant() const { // Check invariants at...
|
||||
[[assert: empty() == (size() == 0)]]
|
||||
[[assert: size() <= capacity()]]
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
vector()
|
||||
[[ensures: invariant()]] // ...constructor exit (only if no throw).
|
||||
{ ... }
|
||||
|
||||
~vector() noexcept
|
||||
[[expects: invariant()]] // ...destructor entry.
|
||||
{ ... }
|
||||
|
||||
void push_back(T const& value)
|
||||
[[expects: invariant()]] // ...public function entry.
|
||||
[[ensures: invariant()]] // ...public function exit (if no throw).
|
||||
try {
|
||||
... // Function body.
|
||||
} catch(...) {
|
||||
invariant(); // ...public function exit (if throw).
|
||||
throw;
|
||||
}
|
||||
|
||||
...
|
||||
};
|
||||
``
|
||||
In case the destructor can throw (e.g., it is declared `noexcept(false)`), the destructor also requires a `try-catch` statement similar to the one programmed for `push_back` to check class invariants at destructor exit when it throws exceptions.
|
||||
]
|
||||
All references reviewed by the authors seem to not consider static and volatile functions not supporting static and volatile invariants respectively.
|
||||
|
||||
* Implementing subcontracting involves a significant amount of complexity and it seems to not be properly supported by any C++ library other than this one (especially when handling multiple inheritance, correctly copying postcondition old values across all overridden contracts deep in the inheritance tree, and correctly reporting the return value to the postconditions of overridden virtual functions in base classes).
|
||||
[footnote
|
||||
For example, it is not really possible to sketch pseudocode based on __P0380__ that emulates subcontracting in the general case.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Examples]
|
||||
|
||||
This section lists some examples taken from different sources discussing Contract Programming and implemented here using this library.
|
||||
|
||||
[note
|
||||
Some of these examples might be from old code, containing obsolete coding practices, not optimized for execution speed, not complete, and they might be more relevant in the context of programming languages different from C++.
|
||||
Nevertheless, programmers are encouraged to review these examples to see a few diverse usages of this library that might be relevant to their needs.
|
||||
]
|
||||
|
||||
Sources of the listed examples:
|
||||
|
||||
* __N1962__: Examples from the proposal to add Contract Programming to C++11 (unfortunately, this proposal was never accepted into the standard).
|
||||
* __Meyer97__: Examples using the Eiffel programming language and reprogrammed using this library for C++.
|
||||
* __Mitchell02__: Additional examples using the Eiffel programming language and reprogrammed using this library for C++.
|
||||
* __Cline90__: Examples from a very early proposal called Annotated C++ (A++) to add Contract Programming to C++ (A++ was never implemented or proposed for addition to the standard).
|
||||
|
||||
A few notable examples:
|
||||
|
||||
* [link N1962_vector_anchor \[N1962\] Vector]: Complete contracts for `std::vector` and a comparison with __N1962__ syntax.
|
||||
* [link N1962_square_root_anchor \[N1962\] Square Root]: Comparison with D syntax.
|
||||
* [link Mitchell02_counter_anchor \[Mitchell02\] Counter]: Subcontracting.
|
||||
* [link Meyer97_stack4_anchor \[Meyer97\] Stack4]: Comparison with Eiffel syntax.
|
||||
* [link Cline90_vector_anchor \[Cline90\] Vector]: Comparison with A++ syntax.
|
||||
|
||||
[#N1962_vector_anchor]
|
||||
[section \[N1962\] Vector: Contracts for STL vector and comparison with C++11 proposal syntax]
|
||||
|
||||
On compilers that support C++17 `if constexpr`, the following example using this library can be simplified removing [funcref boost::contract::condition_if] and related functor templates such as `all_of_equal_to`, etc. (making it more similar to the pseudo-code on the right-hand side).
|
||||
|
||||
[import ../example/n1962/vector.cpp]
|
||||
[import ../example/n1962/vector_n1962.hpp]
|
||||
[table
|
||||
[ [This library] [\[N1962\] proposal (not accepted in C++) plus C++17 [^if constexpr]] ]
|
||||
[ [[n1962_vector]] [[n1962_vector_n1962]] ]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section \[N1962\] Circle: Subcontracting]
|
||||
[import ../example/n1962/circle.cpp]
|
||||
[n1962_circle]
|
||||
[endsect]
|
||||
|
||||
[#N1962_factorial_anchor]
|
||||
[section \[N1962\] Factorial: Recursion]
|
||||
[import ../example/n1962/factorial.cpp]
|
||||
[n1962_factorial]
|
||||
[endsect]
|
||||
|
||||
[section \[N1962\] Equal: Operators]
|
||||
[import ../example/n1962/equal.cpp]
|
||||
[n1962_equal]
|
||||
[endsect]
|
||||
|
||||
[section \[N1962\] Sum: Array parameter]
|
||||
[import ../example/n1962/sum.cpp]
|
||||
[n1962_sum]
|
||||
[endsect]
|
||||
|
||||
[#N1962_square_root_anchor]
|
||||
[section \[N1962\] Square Root: Default parameters and comparison with D syntax]
|
||||
[import ../example/n1962/sqrt.cpp]
|
||||
[import ../example/n1962/sqrt.d]
|
||||
[table
|
||||
[ [This Library] [The D Programming Language] ]
|
||||
[ [[n1962_sqrt]] [[n1962_sqrt_d]] ]
|
||||
]
|
||||
[endsect]
|
||||
|
||||
[#Meyer97_stack4_anchor]
|
||||
[section \[Meyer97\] Stack4: Comparison with Eiffel syntax]
|
||||
[import ../example/meyer97/stack4.hpp]
|
||||
[import ../example/meyer97/stack4_main.cpp]
|
||||
[import ../example/meyer97/stack4.e]
|
||||
[table
|
||||
[ [This Library] [The Eiffel Programming Language] ]
|
||||
[ [[meyer97_stack4]] [[meyer97_stack4_e]] ]
|
||||
[ [[meyer97_stack4_main]] [] ]
|
||||
]
|
||||
[endsect]
|
||||
|
||||
[section \[Meyer97\] Stack3: Error codes instead of preconditions]
|
||||
[import ../example/meyer97/stack3.cpp]
|
||||
[meyer97_stack3]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Name List: Relaxed subcontracts]
|
||||
[import ../example/mitchell02/name_list.cpp]
|
||||
[mitchell02_name_list]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Dictionary: Key-value map]
|
||||
[import ../example/mitchell02/dictionary.cpp]
|
||||
[mitchell02_dictionary]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Courier: Subcontracting and static class invariants]
|
||||
[import ../example/mitchell02/courier.cpp]
|
||||
[mitchell02_courier]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Stack: Stack-like container]
|
||||
[import ../example/mitchell02/stack.cpp]
|
||||
[mitchell02_stack]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Simple Queue: Queue-like container and disable old value copies for audit assertions]
|
||||
[import ../example/mitchell02/simple_queue.cpp]
|
||||
[mitchell02_simple_queue]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Customer Manager: Contracts instead of Defensive Programming]
|
||||
[import ../example/mitchell02/customer_manager.cpp]
|
||||
[mitchell02_customer_manager]
|
||||
[endsect]
|
||||
|
||||
[section \[Mitchell02\] Observer: Pure virtual functions]
|
||||
[import ../example/mitchell02/observer/observer.hpp]
|
||||
[mitchell02_observer]
|
||||
[import ../example/mitchell02/observer/subject.hpp]
|
||||
[mitchell02_subject]
|
||||
[import ../example/mitchell02/observer_main.cpp]
|
||||
[mitchell02_observer_main]
|
||||
[endsect]
|
||||
|
||||
[#Mitchell02_counter_anchor]
|
||||
[section \[Mitchell02\] Counter: Subcontracting]
|
||||
[import ../example/mitchell02/counter/push_button.hpp]
|
||||
[mitchell02_push_button]
|
||||
[import ../example/mitchell02/counter/decrement_button.hpp]
|
||||
[mitchell02_decrement_button]
|
||||
[import ../example/mitchell02/counter/counter.hpp]
|
||||
[mitchell02_counter]
|
||||
[import ../example/mitchell02/counter_main.cpp]
|
||||
[mitchell02_counter_main]
|
||||
[endsect]
|
||||
|
||||
[#Cline90_vector_anchor]
|
||||
[section \[Cline90\] Vector: Comparison with A++ proposal syntax]
|
||||
[import ../example/cline90/vector.hpp]
|
||||
[import ../example/cline90/vector_main.cpp]
|
||||
[import ../example/cline90/vector_axx.hpp]
|
||||
[table
|
||||
[ [This Library] [A++ Proposal (never actually implemented)] ]
|
||||
[ [[cline90_vector]] [[cline90_vector_axx]] ]
|
||||
[ [[cline90_vector_main]] [] ]
|
||||
]
|
||||
[endsect]
|
||||
|
||||
[section \[Cline90\] Stack: Stack-like container]
|
||||
[import ../example/cline90/stack.cpp]
|
||||
[cline90_stack]
|
||||
[endsect]
|
||||
|
||||
[section \[Cline90\] Vector-Stack: Subcontracting]
|
||||
[import ../example/cline90/vstack.cpp]
|
||||
[cline90_vstack]
|
||||
[endsect]
|
||||
|
||||
[section \[Cline90\] Calendar: A very simple calendar]
|
||||
[import ../example/cline90/calendar.cpp]
|
||||
[cline90_calendar]
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
+612
@@ -0,0 +1,612 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Extras]
|
||||
|
||||
This section can be consulted selectively for specific topics of interest.
|
||||
|
||||
[section Old Value Requirements (Templates)]
|
||||
|
||||
Old values require to copy the expression passed to [macroref BOOST_CONTRACT_OLDOF] thus the type of that expression must be copyable.
|
||||
More precisely, dereferencing an old value pointer of type [classref boost::contract::old_ptr]`<T>` requires [classref boost::contract::is_old_value_copyable]`<T>::value` to be `true` (otherwise this library will generate a compile-time error).
|
||||
|
||||
In some cases it might be acceptable, or even desirable, to cause a compile-time error when a program uses old value types that are not copyable (because it is not possible to fully check the correctness of the program as stated by the contract assertions that use these old values).
|
||||
In these cases, programmers can declare old values using [classref boost::contract::old_ptr] as seen so far.
|
||||
|
||||
However, in some other cases it might be desirable to skip assertions that use old values when the respective old value types are not copyable.
|
||||
Programmers can do this by using [classref boost::contract::old_ptr_if_copyable] instead of [classref boost::contract::old_ptr] to program these old values and by checking if the old value pointer is not null before dereferencing it in postconditions.
|
||||
For example, consider the following function template that could in general be instantiated for types `T` that are not copy constructible (that is for which [classref boost::contract::is_old_value_copyable]`<T>::value` is `false`, see [@../../example/features/old_if_copyable.cpp =old_if_copyable.cpp=]):
|
||||
[footnote
|
||||
*Rationale:*
|
||||
__N1962__ and other proposals to add contracts to C++ do not provide a mechanism to selectively disable copies for only old value types that are not copy constructible.
|
||||
However, this library provides such a mechanism to allow to program contracts for template code without necessarily adding extra copy constructible type requirements that would not be present if it were not for copying the old values (so compiling the code with and without contracts will not necessarily alter the type requirements of the program).
|
||||
Something similar could be achieved combing C++17 `if constexpr` with __N1962__ or __P0380__ so that old value expressions within template code could be guarded by `if constexpr` statements checking if the old value types are copyable or not.
|
||||
For example, assuming old values are added to __P0380__ (e.g., via `oldof`) and that C++17 `if constexpr` can be used within __P0380__ contracts:
|
||||
``
|
||||
template<typename T>
|
||||
void offset(T& x, int count)
|
||||
[[ensures: if constexpr(std::is_copy_constructible<T>::value) x == oldof(x) + count]]
|
||||
...
|
||||
``
|
||||
]
|
||||
|
||||
[import ../example/features/old_if_copyable.cpp]
|
||||
[old_if_copyable_offset]
|
||||
|
||||
The old value pointer `old_x` is programmed using [classref boost::contract::old_ptr_if_copyable] so if `T` is not copyable then `x` will simply not be copied and `old_x` will be left as a null pointer (here `old_x` must be checked to be not null `if(old_x) ...` before it is dereferenced in postconditions and exception guarantees).
|
||||
If the above example used [classref boost::contract::old_ptr] instead then the library would have generated a compile-time error when `offset` is instantiated with types `T` that are not copy constructible (but only if `old_x` is actually dereferenced somewhere in the contract assertions using `*old_x ...`, `old_x->...`, etc.).
|
||||
|
||||
When C++11 `auto` declarations are used with [macroref BOOST_CONTRACT_OLDOF], this library always defaults to using the [classref boost::contract::old_ptr] type (because this type requirements are more stringent, if programmers want to relax the copyable type requirement they must do so explicitly by using [classref boost::contract::old_ptr_if_copyable] instead of using `auto`).
|
||||
For example, the following will use [classref boost::contract::old_ptr] and not [classref boost::contract::old_ptr_if_copyable] to declare `old_x`:
|
||||
|
||||
auto old_x = BOOST_CONTRACT_OLDOF(x); // C++11 auto declarations always use `old_ptr` (never `old_ptr_if_copyable`).
|
||||
|
||||
This library internally uses [classref boost::contract::is_old_value_copyable] to determine if an old value type is copyable or not, and then [classref boost::contract::old_value_copy] to actually copy the old value.
|
||||
By default, [classref boost::contract::is_old_value_copyable]`<T>` is equivalent to `boost::is_copy_constructible<T>` and [classref boost::contract::old_value_copy]`<T>` is implemented using `T`'s copy constructor.
|
||||
However, these type traits can be specialized by programmers for example to avoid making old value copies of types even when they have a copy constructor (maybe because these copy constructors are too expensive), or to make old value copies for types that do not have a copy constructor, or for any other specific need programmers might have for the types in question.
|
||||
For example, the following specialization of [classref boost::contract::is_old_value_copyable] intentionally avoids making old value copies for all expressions of type `w` even if that type has a copy constructor (see [@../../example/features/old_if_copyable.cpp =old_if_copyable.cpp=]):
|
||||
|
||||
[old_if_copyable_w_decl]
|
||||
[old_if_copyable_w_spec]
|
||||
|
||||
On the flit side, the following specializations of [classref boost::contract::is_old_value_copyable] and [classref boost::contract::old_value_copy] make old value copies of expressions of type `p` even if that type does not actually have a copy constructor (see [@../../example/features/old_if_copyable.cpp =old_if_copyable.cpp=]):
|
||||
|
||||
[old_if_copyable_p_decl]
|
||||
[old_if_copyable_p_spec]
|
||||
|
||||
[heading No C++11]
|
||||
|
||||
In general, `boost::contract::is_copy_constructible` and therefore [classref boost::contract::is_old_value_copyable] require C++11 `decltype` and SFINAE to automatically detect if a given type is not copyable.
|
||||
On non-C++11 compilers, it is possible to inherit the old value type from `boost::noncopyable`, or use `BOOST_MOVABLE_BUT_NOT_COPYABLE`, or specialize `boost::is_copy_constructible` (see [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `boost::is_copy_constructible`] documentation for more information).
|
||||
Alternatively, it is possible to just specialize [classref boost::contract::is_old_value_copyable].
|
||||
For example, for a non-copyable type `n` (see [@../../example/features/old_if_copyable.cpp =old_if_copyable.cpp=]):
|
||||
|
||||
[old_if_copyable_n_decl]
|
||||
[old_if_copyable_n_spec]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Assertion Requirements (Templates)]
|
||||
|
||||
In general, assertions can introduce a new set of requirements on the types used by a program.
|
||||
Some of these type requirements might be necessary only to check the assertions and they would not be required by the program otherwise.
|
||||
|
||||
In some cases it might be acceptable, or even desirable, to cause a compile-time error when a program uses types that do not provide all the operations needed to check contract assertions (because it is not possible to fully check the correctness of the program as specified by its contracts).
|
||||
In these cases, programmers can specify contract assertions as we have seen so far, compilation will fail if user types do not provide all operations necessary to check the contracts.
|
||||
|
||||
However, in some other cases it might be desirable to not augment the type requirements of a program because of contract assertions and to skip these assertions when user types do not provide all the operations necessary to check them.
|
||||
Programmers can do this by using [funcref boost::contract::condition_if] (or [funcref boost::contract::condition_if_c]).
|
||||
|
||||
For example, let's consider the following `vector<T>` class template.
|
||||
This class template does not usually require that its type parameter `T` has an equality operator `==` (it only requires `T` to be copy constructible, see `std::vector` documentation).
|
||||
However, the contracts for the `vector<T>::push_back(value)` public function include a postcondition `back() == value` that introduces the new requirement that `T` must also have an equality operator `==`.
|
||||
Programmers can specify this postcondition as usual with `BOOST_CONTRACT_ASSERT(back() == value)` an let the program fail to compile when users instantiate `vector<T>` with a type `T` that does not provide an equality operator `==`.
|
||||
Otherwise, programmers can specify this postcondition using [funcref boost::contract::condition_if] to evaluate the asserted condition only for types `T` that have an equality operator `==` (and trivially evaluate to `true` otherwise).
|
||||
On C++17 compilers, the same can be achieved using `if constexpr` instead of [funcref boost::contract::condition_if] resulting in a more concise and readable syntax.
|
||||
For example (see [@../../example/features/condition_if.cpp =condition_if.cpp=]):
|
||||
|
||||
[import ../example/features/condition_if.cpp]
|
||||
[table
|
||||
[[Until C++17 (without `if constexpr`)][Since C++17 (with `if constexpr`)]]
|
||||
[[[condition_if]] [``
|
||||
template<typename T>
|
||||
class vector {
|
||||
public:
|
||||
void push_back(T const& value) {
|
||||
boost::contract::check c = boot::contract::public_function(this)
|
||||
.postcondition([&] {
|
||||
// Guard with `if constexpr` for T without `==`.
|
||||
if constexpr(boost::has_equal_to<T>::value)
|
||||
BOOST_CONTRACT_ASSERT(back() == value);
|
||||
})
|
||||
;
|
||||
|
||||
vect_.push_back(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ... */
|
||||
``]]
|
||||
]
|
||||
|
||||
The [funcref boost::contract::condition_if] function template is a special case of the more general facility [funcref boost::contract::call_if]:
|
||||
Specifically, [funcref boost::contract::condition_if]`<`[^['Predicate]]`>(`[^['condition]]`)` is equivalent to:
|
||||
[footnote
|
||||
For optimization reasons, the internal implementation of [funcref boost::contract::condition_if] does not actually uses [funcref boost::contract::call_if] (but in principle [funcref boost::contract::condition_if] could be implemented using [funcref boost::contract::call_if] as shown in this documentation).
|
||||
]
|
||||
|
||||
boost::contract::call_if<``[^['Predicate]]``>(
|
||||
``[^['condition]]``
|
||||
).else_(
|
||||
[] { return true; }
|
||||
)
|
||||
|
||||
Where [^['Predicate]] is a nullary boolean meta-function and [^['condition]] is a nullary boolean functor.
|
||||
If [^['Predicate]]`::value` is statically evaluated to be `true` at compile-time then [^['condition]]`()` is called at run-time and its boolean result is returned by the enclosing `call_if`.
|
||||
Otherwise, if [^['Predicate]]`::value` is statically evaluated to be `false` at compile-time then the lambda function `[] { return true; }()` is called at run-time and `true` is trivially returned by the enclosing `call_if`.
|
||||
Therefore, if [^['condition]] is a functor template (and not just a functor) then its code that contains the assertion operations with the extra type requirements (e.g., the equality operator `==`) will not be instantiated and compiled for specific types unless the compiler determines at compile-time that [^['Predicate]]`::value` is `true` (functor templates like `std::equal_to` and C++14 generic lambdas can be used to program [^['condition]], but C++11 lambdas cannot).
|
||||
|
||||
More in general, [funcref boost::contract::call_if] accepts a number of optional /else-if/ statements and one optional /else/ statement:
|
||||
|
||||
boost::contract::call_if<``[^['Predicate1]]``>(
|
||||
``[^['then1]]``
|
||||
).template else_if<``[^['Predicate2]]``>( // Optional.
|
||||
``[^['then2]]``
|
||||
)
|
||||
... // Optionally, other `else_if` statements.
|
||||
.else_( // Optional for `void` functors, otherwise required.
|
||||
``[^['else]]``
|
||||
)
|
||||
|
||||
Where [^['Predicate1]], [^['Predicate2]], ... are nullary boolean meta-functions and [^['then1]], [^['then2]], ..., [^['else]] are nullary functors.
|
||||
The return types of the functor calls [^['then1]]`()`, [^['then2]]`()`, ..., [^['else]]`()` must either be all the same (including all `void`) or be of types implicitly convertible into one another.
|
||||
At run-time [funcref boost::contract::call_if] will call the functor [^['then1]]`()`, or [^['then2]]`()`, ..., or [^['else]]`()` depending on which meta-function [^['Predicate1]]`::value`, [^['Predicate2]]`::value`, ... is statically evaluated to be `true` or `false` at compile-time, and it will return the value returned by the functor being called.
|
||||
If [^['then1]], [^['then2]], ..., [^['else]] are nullary functor templates (not just nullary functors) then their code will only be compiled if the compiler determines they need to be actually called at run-time (so only if the related [^['Predicate1]]`::value`, [^['Predicate2]]`::value`, ... are evaluated to be `true` or `false` at compile-time).
|
||||
All the `else_if<...>(...)` statements are optional, the `else_(...)` statement is optional if the functor calls return `void` but it is required otherwise.
|
||||
|
||||
In general, [funcref boost::contract::call_if] can be used to program contract assertions that compile and check different functor templates depending on related predicates being statically evaluated to be `true` or `false` at compile-time (but in most cases [funcref boost::contract::condition_if] should be sufficient and less verbose to use).
|
||||
The [funcref boost::contract::condition_if_c], [funcref boost::contract::call_if_c], and `.else_if_c` function templates work similarly to their counterparts without the `..._c` postfix above, but they take their predicate template parameters as static boolean values instead of nullary boolean meta-functions.
|
||||
|
||||
Another example where assertion requirements might be useful is to disable assertions that might be constant-correct only for specific template types.
|
||||
For example, `std::distance` does not alter its iterator arguments but only for forward iterators so the follow template function evaluates its preconditions only for for those types (for convenience this example uses C++17 `if constexpr` but it could have been implemented using [funcref boost::contract::condition_if] together with C++14 generic lambdas or binding to a C++11 functor template that calls `std::distance` in its `operator()`):
|
||||
|
||||
template<typename InputIter>
|
||||
void display_first_second_next(InputIter begin, InputIter end) {
|
||||
boost::contract::check c = boost::contract::function()
|
||||
.precondition([&] {
|
||||
if constexpr(is_forward_iterator<InputIter>::value) {
|
||||
BOOST_CONTRACT_ASSERT(std::distance(begin, end) >= 2);
|
||||
} // Otherwise, std::distance would change begin and end.
|
||||
})
|
||||
;
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
[heading If-Constexpr Emulation (C++14)]
|
||||
|
||||
The [funcref boost::contract::call_if] function template is a general facility and its use is not limited to programming contracts.
|
||||
In fact, [funcref boost::contract::call_if] can be used together with C++14 generic lambdas to emulate statements similar to C++17 `if constexpr`
|
||||
For example (see [@../../example/features/call_if_cxx14.cpp =call_if_cxx14.cpp=]):
|
||||
[footnote
|
||||
Boost.Hana (`boost::hana::if_`) can also be used together with C++14 generic lambdas to emulate statements similar to C++17 `if constexpr`.
|
||||
]
|
||||
|
||||
[import ../example/features/call_if_cxx14.cpp]
|
||||
[table
|
||||
[[Until C++17 (without `if constexpr`)][Since C++17 (with `if constexpr`)]]
|
||||
[[[call_if_cxx14]] [``
|
||||
template<typename Iter, typename Dist>
|
||||
void myadvance(Iter& i, Dist n) {
|
||||
if constexpr(is_random_access_iterator<Iter>::value) {
|
||||
i += n;
|
||||
} else if constexpr(is_bidirectional_iterator<Iter>::value) {
|
||||
if(n >= 0) while(n--) ++i;
|
||||
else while(n++) --i;
|
||||
} else if constexpr(is_input_iterator<Iter>::value) {
|
||||
while(n--) ++p;
|
||||
} else {
|
||||
static_assert(false, "requires at least input iterator");
|
||||
}
|
||||
}
|
||||
``]]
|
||||
]
|
||||
|
||||
This implementation is more concise, easier to read and maintain than the usual implementation of `std::advance` that uses tag dispatching.
|
||||
Of course the implementation that uses C++17 `if constexpr` is even more readable and concise.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Volatile Public Functions]
|
||||
|
||||
This library allows to specify a different set of class invariants to check for volatile public functions.
|
||||
These /volatile class invariants/ are programmed in a public `const volatile` function, named `invariant`, taking no argument, and returning `void` (see [macroref BOOST_CONTRACT_INVARIANT_FUNC] to name the invariant function differently from `invariant` and __Access_Specifiers__ to not have to declare it `public`).
|
||||
Classes that do no have invariants for their volatile public functions, simply do not declare the `void invariant() const volatile` function.
|
||||
|
||||
In general, `const volatile` invariants work the same as `const` invariants (see __Class_Invariants__) with the only difference that `volatile` and `const volatile` functions check `const volatile` invariants while non-`const` (i.e., neither `const` nor `volatile`) and `const` functions check `const` invariants.
|
||||
A given class can specify any combination of `static`, `const volatile`, and `const` invariant functions (see __Class_Invariants__):
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Constructors and destructors check `const volatile` and `const` invariants in that order because the qualifier that can be applied to more calls is checked first (note that `const volatile` calls can be made on any object while `const` calls cannot be made on `volatile` objects, in that sense the `const volatile` qualifier can be applied to more calls than `const` alone can).
|
||||
This is consistent with `static` class invariants that are checked even before `const volatile` invariants (the `static` classifier can be applied to even more calls than `const volatile`, in fact an object is not even needed to make static calls).
|
||||
]
|
||||
|
||||
* Constructors check `static` invariants at entry and exit (even if an exception is thrown), plus `const volatile` and `const` invariants in that order at exit but only if no exception is thrown.
|
||||
* Destructors check `static` invariants at entry and exit (even if an exception is thrown), plus `const volatile` and `const` invariants in that order at entry (and at exit but only if an exception is thrown, even is destructors should in general never throw in C++).
|
||||
* Both non-`const` and `const` public functions check `static` and `const` invariants at entry and at exit (even if an exception is thrown).
|
||||
* Both `volatile` and `const volatile` public functions check `static` and `const volatile` invariants at entry and at exit (even if an exception is thrown).
|
||||
|
||||
These rules ensure that volatile class invariants are correctly checked (see __Constructor_Calls__, __Destructor_Calls__, and __Public_Function_Calls__).
|
||||
For example (see [@../../example/features/volatile.cpp =volatile.cpp=]):
|
||||
|
||||
[import ../example/features/volatile.cpp]
|
||||
[volatile]
|
||||
|
||||
This library does not automatically check `const volatile` invariants for non-`volatile` functions.
|
||||
However, if the contract specifications require it, programmers can explicitly call the `const volatile` invariant function from the `const` invariant function (preferably in that order to be consistent with the order `const volatile` and `const` invariants are checked for constructors and destructors).
|
||||
That way all public functions, `volatile` or not, will check `const volatile` invariants (while only `const` and non-`const` public functions will check only `const` invariants, correctly so because the `volatile` qualifier shall not be stripped away):
|
||||
[footnote
|
||||
*Rationale:*
|
||||
Note that while all public functions can be made to check `const volatile` invariants, it is never possible to make volatile public functions check `const` non-volatile invariants.
|
||||
That is because both `const` and `volatile` can always be added but never stripped in C++ (a part from forcefully via `const_cast`) but `const` is always automatically added by this library in order to enforce contract constant-correctness (see __Constant_Correctness__).
|
||||
That said, it would be incorrect for this library to also automatically add `volatile` and require all functions to check `const volatile` (not just `const`) invariants because only `volatile` members can be accessed from `const volatile` invariants so there could be many `const` (but not `const volatile`) members that are accessible from `const` invariants but not from `const volatile` invariants.
|
||||
To avoid this confusion, this library has chosen to draw a clear dichotomy between `const` and `const volatile` invariants so that only volatile public functions check `const volatile` invariants and only non-volatile public functions check `const` (but not `const volatile`) invariants.
|
||||
This is simple and should serve most cases.
|
||||
If programmers need non-volatile public functions to also check `const volatile` invariants, they can explicitly do so by calling the `const volatile` invariant function from the `const` invariant function as shown in this documentation.
|
||||
]
|
||||
|
||||
class a {
|
||||
public:
|
||||
void invariant() const volatile { ... } // Volatile invariants.
|
||||
|
||||
void invariant() const {
|
||||
const_cast<a const volatile*>(this)->invariant(); // Call `const volatile` invariant function above.
|
||||
... // Other non-volatile invariants.
|
||||
}
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
(As usual, private and protected functions do not check any invariant, not even when they are `volatile` or `const volatile`, see __Private_and_Protected_Functions__).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Move Operations]
|
||||
|
||||
As with all public operations of a class, also move operations should maintain class invariants (see __Stroustrup13__, p. 520).
|
||||
Specifically, C++ requires the following:
|
||||
|
||||
* The moved-from object can be copy assigned.
|
||||
* The moved-from object can be move assigned.
|
||||
* The moved-from object can be destroyed (if not for anything else, this requires that class invariants are maintained by move operations because the destructor of the moved-from object requires class invariants to be satisfied at its entry, as always with destructors see __Destructor_Calls__).
|
||||
|
||||
Therefore, both the move constructor and the move assignment operator need to maintain the class invariants of the moved-from object so their contracts can be programmed using [funcref boost::contract::constructor] and [funcref boost::contract::public_function] as always for constructors and public functions.
|
||||
For example (see [@../../example/features/move.cpp =move.cpp=]):
|
||||
|
||||
[import ../example/features/move.cpp]
|
||||
[move]
|
||||
|
||||
This example assumes that it is possible to call the public function `moved()` on the moved-from object.
|
||||
This allows to make explicit the precondition that except for destructor, copy and move assignments all other public functions cannot be called on a moved-from object.
|
||||
This precondition is usually implicit in C++ (i.e., documented by the standard but not checked by the language at run-time).
|
||||
If it is is not possible (e.g., due to some optimized implementation of the move operations) to have such a `moved()` public function, the private `moved_` member (or similar) can be used to program class invariants and preconditions (and that will just relay on the usual implicit C++ assumption on moved-from object because users will not be able to fully check preconditions and class invariants before calling functions of a moved-from object).
|
||||
|
||||
[note
|
||||
The default move constructor and move assignment operator generated by C++ will not automatically check contracts.
|
||||
Therefore, unless the move operations are not public or they have no preconditions, no postconditions, and their class has no invariants, programmers should manually define them using [funcref boost::contract::constructor], [classref boost::contract::constructor_precondition], and [funcref boost::contract::public_function] instead of relying on their default implementations generated by C++.
|
||||
(Same as for all other operations automatically implemented by C++.)
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Unions]
|
||||
|
||||
In C++, a `union` cannot have virtual functions, bases classes, and cannot be used as a base class thus subcontracting ([classref boost::contract::virtual_], [macroref BOOST_CONTRACT_OVERRIDE], etc.) do not apply to unions.
|
||||
Also a `union` cannot inherit from [classref boost::contract::constructor_precondition] (because it cannot have base classes) so such a class is used to declare a local object that checks constructor preconditions (at the very beginning of the constructor before old value copies and other contracts, see declaration of `pre` in the example below).
|
||||
A part from that, this library is used as usual to program contracts for unions.
|
||||
For example (see [@../../example/features/union.cpp =union.cpp=]):
|
||||
|
||||
[import ../example/features/union.cpp]
|
||||
[union]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Disable Contract Checking]
|
||||
|
||||
Checking contracts adds run-time overhead and can slow down program execution (see __Benefits_and_Costs__).
|
||||
Therefore, programmers can define any combination of the following macros (`-D` option in Clang and GCC, `/D` option in MSVC, etc.) to instruct this library to not check specific kind of contract conditions at run-time:
|
||||
|
||||
* Define [macroref BOOST_CONTRACT_NO_PRECONDITIONS] to not check preconditions.
|
||||
* Define [macroref BOOST_CONTRACT_NO_POSTCONDITIONS] to not check postconditions.
|
||||
* Define [macroref BOOST_CONTRACT_NO_EXCEPTS] to not check exception guarantees.
|
||||
* Define [macroref BOOST_CONTRACT_NO_ENTRY_INVARIANTS] to not check class invariants at call entry.
|
||||
* Define [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS] to not check class invariants at call exit.
|
||||
* Or, define [macroref BOOST_CONTRACT_NO_INVARIANTS] to not check class invariants at both call entry and exit. (This is provided for convenience, it is equivalent to define both [macroref BOOST_CONTRACT_NO_ENTRY_INVARIANTS] and [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS].)
|
||||
* Define [macroref BOOST_CONTRACT_NO_CHECKS] to not run implementation checks (programmed using [macroref BOOST_CONTRACT_CHECK], etc.).
|
||||
|
||||
[note
|
||||
In general, old values are used by both postconditions and exception guarantees so it is necessary to define both [macroref BOOST_CONTRACT_NO_POSTCONDITIONS] and [macroref BOOST_CONTRACT_NO_EXCEPTS] to disable old value copies.
|
||||
]
|
||||
|
||||
By default, none of these macros are defined so this library checks all contracts.
|
||||
When these macros are defined by the user, the implementation code of this library is internally optimized to minimize as much as possible any run-time and compile-time overhead associated with checking and compiling contracts (see __Disable_Contract_Compilation__ for techniques to completely remove any run-time and compile-time overhead associated with contract code).
|
||||
|
||||
For example, programmers could decide to check all contracts during early development builds, but later check only preconditions and maybe entry invariants for release builds by defining [macroref BOOST_CONTRACT_NO_POSTCONDITIONS], [macroref BOOST_CONTRACT_NO_EXCEPTS], [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS], and [macroref BOOST_CONTRACT_NO_CHECKS].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Assertion Levels]
|
||||
|
||||
This library provides three predefined /assertion levels/ that can be used depending on the computational complexity of the asserted conditions:
|
||||
[footnote
|
||||
The assertion levels predefined by this library are similar to the default, audit, and axiom levels proposed in __P0380__.
|
||||
]
|
||||
|
||||
* [macroref BOOST_CONTRACT_ASSERT] is used to assert conditions that are not computationally expensive, at least compared to the cost of executing the function body.
|
||||
These assertions are always checked at run-time and cannot be disabled.
|
||||
* [macroref BOOST_CONTRACT_ASSERT_AUDIT] is used to assert conditions that are computationally expensive compared to the cost of executing the function body.
|
||||
These assertions are not checked at run-time unless programmers explicitly define [macroref BOOST_CONTRACT_AUDITS] (undefined by default), but the conditions are always compiled and validated syntactically (even when they are not actually evaluated and checked at run-time).
|
||||
* [macroref BOOST_CONTRACT_ASSERT_AXIOM] is used to assert conditions that are computationally prohibitive, at least compared to the cost of executing the function body.
|
||||
These assertions are never evaluated or checked at run-time, but the asserted conditions are always compiled and validated syntactically so these assertions can serve as formal comments in the code.
|
||||
|
||||
In addition, [macroref BOOST_CONTRACT_CHECK_AUDIT] and [macroref BOOST_CONTRACT_CHECK_AXIOM] are similar to [macroref BOOST_CONTRACT_ASSERT_AUDIT] and [macroref BOOST_CONTRACT_ASSERT_AXIOM] but they are used to program audit and axiom levels for implementation checks instead of assertions (see __Implementation_Checks__).
|
||||
|
||||
For example, [macroref BOOST_CONTRACT_ASSERT_AUDIT] can be used to program computationally expensive assertions (see [@../../example/features/assertion_level.cpp =assertion_level.cpp=]):
|
||||
|
||||
[import ../example/features/assertion_level.cpp]
|
||||
[assertion_level_audit]
|
||||
|
||||
Also [macroref BOOST_CONTRACT_AUDITS] can be used to disable expensive old value copies and related assertions that use them (see [@../../example/features/assertion_level.cpp =assertion_level.cpp=]):
|
||||
|
||||
[assertion_level_class_begin]
|
||||
[assertion_level_audit_old]
|
||||
[assertion_level_class_end]
|
||||
|
||||
The condition passed to [macroref BOOST_CONTRACT_ASSERT_AXIOM] is compiled but not actually evaluated at run-time so this macro can be used to program computationally prohibitive assertions but also assertions that cannot actually be programmed in C++ using functions that are declared but left undefined.
|
||||
For example, (see [@../../example/features/assertion_level.cpp =assertion_level.cpp=]):
|
||||
|
||||
[assertion_level_no_impl]
|
||||
[assertion_level_class_begin]
|
||||
[assertion_level_axiom]
|
||||
[assertion_level_class_end]
|
||||
|
||||
In addition to the assertion levels predefined by this library, programmers are free to define their own.
|
||||
For example, the following macro could be used to program and selectively disable assertions that have exponential computational complexity `O(e^n)`:
|
||||
|
||||
#ifdef NO_EXPONENTIALLY_COMPLEX_ASSERTIONS
|
||||
// Following will compile but never actually evaluate `cond`.
|
||||
#define EXP_ASSERTION(cond) BOOST_CONTRACT_ASSERT(true || (cond))
|
||||
#else
|
||||
// Following will compile and also evaluate `cond`.
|
||||
#define EXP_ASSERTION(cond) BOOST_CONTRACT_ASSERT(cond)
|
||||
#endif
|
||||
|
||||
...
|
||||
|
||||
EXP_ASSERTION(``[^['some-exponentially-complex-boolean-condition]]``);
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Disable Contract Compilation (Macro Interface)]
|
||||
|
||||
This library provides macros that can be used to completely disable compile-time and run-time overhead introduced by contracts but at the cost of manually programming `#ifndef` statements around contract code:
|
||||
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_CONSTRUCTORS] when contract checking is disabled for constructors.
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_DESTRUCTORS] when contract checking is disabled for destructors.
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS] when contract checking is disabled for public functions.
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_FUNCTIONS] when contract checking is disabled for (non-public) functions.
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_OLDS] when old value copies are disabled.
|
||||
* This library defines [macroref BOOST_CONTRACT_NO_ALL] when checks are disabled for all contracts above.
|
||||
|
||||
These macros are not configuration macros and they should not be defined directly by the users (otherwise this library will generate a compile-time error).
|
||||
Instead, these macros are automatically defined by this library when users define [macroref BOOST_CONTRACT_NO_PRECONDITIONS], [macroref BOOST_CONTRACT_NO_POSTCONDITIONS], [macroref BOOST_CONTRACT_NO_EXCEPTS], [macroref BOOST_CONTRACT_NO_INVARIANTS] (or [macroref BOOST_CONTRACT_NO_ENTRY_INVARIANTS] and [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS]), and [macroref BOOST_CONTRACT_NO_CHECKS] (see __Disable_Contract_Checking__).
|
||||
|
||||
Alternatively, this library provides a macro-based interface [headerref boost/contract_macro.hpp] that can be used to completely disable compile-time and run-time overhead introduced by contracts.
|
||||
This macro interface is usually preferred because more concise and easier to use than programming `#ifdef` statements by hand, but it can make compiler errors more cryptic (because all macro code expands on a single line in C++ so line numbers in compiler errors are less useful than usual) and it leave a bit of contract decorations in the code but at no measurable overhead (extra [classref boost::contract::virtual_]`*` parameter, call to [classref boost::contract::constructor_precondition] default constructor which does nothing, [macroref BOOST_CONTRACT_BASE_TYPES] `typedef`, and [classref boost::contract::access] friendship, see example below).
|
||||
|
||||
The following examples show how to use both the macro interface and alternatively the `#ifdef` statements to completely disable compile-time and run-time overhead introduced by contracts (see [@../../example/features/ifdef_macro.cpp =ifdef_macro.cpp=] and [@../../example/features/ifdef.cpp =ifdef.cpp=]):
|
||||
|
||||
[import ../example/features/ifdef_macro.cpp]
|
||||
[import ../example/features/ifdef.cpp]
|
||||
[table
|
||||
[ [Macro Interface] [`#ifdef` Statements] ]
|
||||
[ [[ifdef_macro_function]] [[ifdef_function]] ]
|
||||
]
|
||||
|
||||
The same can be used to disable contract code complication for private and protected functions.
|
||||
The [macroref BOOST_CONTRACT_OLD_PTR_IF_COPYABLE] macro is provided to handle non-copyable old value types (equivalently to [classref boost::contract::old_ptr_if_copyable]).
|
||||
For constructors, destructors, and public functions instead (see [@../../example/features/ifdef_macro.cpp =ifdef_macro.cpp=] and [@../../example/features/ifdef.cpp =ifdef.cpp=]):
|
||||
|
||||
[table
|
||||
[ [Macro Interface] [`#ifdef` Statements] ]
|
||||
[ [[ifdef_macro_class]] [[ifdef_class]] ]
|
||||
]
|
||||
|
||||
Static class invariants can be programmed using [macroref BOOST_CONTRACT_STATIC_INVARIANT] and volatile class invariants using [macroref BOOST_CONTRACT_INVARIANT_VOLATILE] (these macros expand code equivalent to the `static void `[macroref BOOST_CONTRACT_STATIC_INVARIANT_FUNC]`()` and `void `[macroref BOOST_CONTRACT_INVARIANT_FUNC]`() const volatile` functions respectively).
|
||||
|
||||
Macro code expands on a single line so using the macro interface will cause all assertions within a given set of preconditions, postconditions, exception guarantees, and class invariants to list the same line number in their error messages if they fail at run-time (but the assertion code will be listed as well and it should allow programmers to identify the specific assertion that failed).
|
||||
In general, the authors do not recommend to use the macro interface and the `#ifdef` statements unless strictly necessary because they both make the contract code more verbose, less readable, and can cause cryptic error messages.
|
||||
|
||||
That said, disabling contract as shown in __Disable_Contract_Checking__ will still leave the overhead of compiling contract code plus some small run-time overhead due to the initialization of old value pointers (even if those will be all null and no old value will be actually copied), the calls to the contract functions used to initialize [classref boost::contract::check] and [classref boost::contract::constructor_precondition] (even if those calls will be internally optimized by this library to essentially do nothing), etc.
|
||||
For truly performance critical code for which even such small run-time overhead might not be acceptable, the macro interface (or the `#ifdef` statements) shown here can be used to completely disable compile-time and run-time overheads of contracts.
|
||||
However, for such performance-critical code even the overhead of checking simple preconditions might be too much so it might be best to not program contracts for such performance-critical code all together.
|
||||
|
||||
Therefore, in most cases the compile-time overhead of contracts should not represent an issue and it should be sufficient to disable contract checking at run-time as indicated in __Disable_Contract_Checking__.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Separate Body Implementation]
|
||||
|
||||
Contracts are part of the program specification and not of its implementation (see __Specification_vs_Implementation__).
|
||||
However, this library uses function definitions to program contracts so contract code appears together with the function implementation code.
|
||||
This is not ideal (even if contracts programmed using this library will always appear at the very beginning of the function definition so programmers will easily be able to distinguish contract code from the rest of the function implementation code and this might not be real problem in practise).
|
||||
|
||||
In some cases, it might be desirable to completely separate the contract code from the function implementation code.
|
||||
For example, this could be necessary for software that ships only header files and compiled object files to its users.
|
||||
If contracts are programmed in function definitions that are compiled in the object files, users will not be able to see the contract code to understand semantics and usage of the functions (again, this might not be a real problem in practice for example if contracts are already somehow extracted from the source code and presented as part of the documentation of the shipped software).
|
||||
|
||||
In any case, when it is truly important to separate contracts from function implementation code, function implementations can be programmed in extra /body functions/ (e.g., named `..._body`) that are compiled in object files.
|
||||
Function definitions that remain in header files instead will contain just contract code followed by calls the extra body functions.
|
||||
This technique allows to keep the contract code in header files while separating the implementation code to object files but at the cost of manually programming an extra function declaration for the body function (and with the limitation that constructor member initialization lists must be programmed in header files because that is where constructors need to be defined to list the constructor contract code).
|
||||
|
||||
For example, the following header file only contains function declarations, contract code, and constructor member initializations, but it does not contain the code implementing the function bodies (see [@../../example/features/separate_body.hpp =separate_body.hpp=]):
|
||||
|
||||
[import ../example/features/separate_body.hpp]
|
||||
[separate_body_hpp]
|
||||
|
||||
Instead, the function bodies are implemented in a separate source file (see [@../../example/features/separate_body.cpp =separate_body.cpp=]):
|
||||
|
||||
[import ../example/features/separate_body.cpp]
|
||||
[separate_body_cpp]
|
||||
|
||||
The same technique can be used for non-member, private, and protected functions, etc.
|
||||
|
||||
[note
|
||||
When contracts are programmed only in =.cpp= files and also all this library headers are `#include`d only from the =.cpp= files, then these =.cpp= files can be compiled disabling specific contract checking (for example, [macroref BOOST_CONTRACT_NO_POSTCONDITIONS], [macroref BOOST_CONTRACT_NO_EXCEPTS], and [macroref BOOST_CONTRACT_NO_EXIT_INVARIANTS], see __Disable_Contract_Checking__).
|
||||
Then the code in these =.cpp= files will always have such contract checking disabled even when linked to some other user code that might have been compiled with a different set of contracts disabled (i.e., a different set of `BOOST_CONTRACT_NO_...` macros defined).
|
||||
This technique might be useful to ship compiled object files (e.g., for a library) that will never check some contracts (e.g., postconditions, exception guarantees, and exit invariants) regardless of the definition of the `BOOST_CONTRACT_NO_...` macros used to compile code that links against the shipped object files.
|
||||
|
||||
On the contrary, if contracts are programmed only in header files (e.g., using extra `..._body` functions as shown in this section) and this library headers are `#include`d only in these header files that are being shipped, then end users can enable or disables contract checking of the shipped code by defining the `BOOST_CONTRACT_NO_...` macros when they compile the shipped header files as part of their code.
|
||||
This technique might be useful in other situations when programmers that ship code want to leave it up the their end users to decide which contracts of the shipped code should be checked at run-time.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section No Lambda Functions (No C++11)]
|
||||
|
||||
This section shows how to use this library without C++11 lambda functions.
|
||||
This has some advantages:
|
||||
|
||||
* It allows to use this library on compilers that do not support C++11 lambda functions (essentially most C++03 compilers can be used in that case, see __No_Macros__ to also avoid using variadic macros).
|
||||
* Contract functions (i.e., the `..._precondition`, `..._old`, and `..._postcondition` functions in the example below) can be programmed to fully enforce constant-correctness and other contract requirements at compile-time (see __Constant_Correctness__).
|
||||
[footnote
|
||||
If C++ allowed lambda functions to capture variables by constant reference (for example using the syntax `[const&] { ... }` and `[const& `[^['variable-name]]`] { ... }`, see [@https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/0UKQw9eo3N0]) also lambdas could be used to program contract functors that fully enforce __Constant_Correctness__ at compile-time.
|
||||
Note that C++11 lambdas allow to capture variables by value (`[=] { ... }` and `[`[^['variable-name]]`] { ... }`), these value captures are `const` (unless the lambda is explicitly declared `mutable`) but they are not suitable to program postconditions and exception guarantees using this library (because those require capturing by reference, see __Postconditions__ and __Exception_Guarantees__), plus they introduce a copy of the captured value that might be too expensive in general and therefore not suitable for preconditions either.
|
||||
]
|
||||
* Code of the contract functions is separated from function body implementations (see __Separate_Body_Implementation__).
|
||||
[footnote
|
||||
Alternatively, on compilers that do not support C++11 lambda functions, [@http://www.boost.org/doc/libs/release/libs/local_function/doc/html/index.html Boost.LocalFunction] could be used to program the contract functors still within the function definitions (for example, see [@../../example/features/no_lambdas_local_func.cpp =no_lambda_local_func.cpp=]).
|
||||
In general, such a code is less verbose than the example shown in this section that uses contract functions programmed outside of the original function definitions (about 30% less lines of code) but the contract code is hard to ready.
|
||||
Other libraries could also be used to program the contract functors without C++11 lambda functions (Boost.Lambda, Boost.Fusion, etc.) but again all these techniques will result in contract code either more verbose, or harder to read and maintain than the code that uses C++11 lambda functions.
|
||||
]
|
||||
|
||||
However, not using C++11 lambda functions comes to the significant cost of having to manually program the extra contract function and related boiler-plate code.
|
||||
For example (see [@../../example/features/no_lambdas.hpp =no_lambdas.hpp=] and [@../../example/features/no_lambdas.cpp =no_lambdas.cpp=]):
|
||||
|
||||
[import ../example/features/no_lambdas.hpp]
|
||||
[no_lambdas_hpp]
|
||||
|
||||
[import ../example/features/no_lambdas.cpp]
|
||||
[no_lambdas_cpp]
|
||||
|
||||
If programmers also want to fully enforce all contract programming constant-correctness requirements at compile-time, they should follow these rules when programming the contract functions (see __Constant_Correctness__):
|
||||
|
||||
* Precondition functions (i.e., the `..._precondition` functions in the example above) can take their arguments either by `const` value or by `const&`, and when they are member functions they should be either `static` or `const` functions.
|
||||
* Postcondition functions (i.e., the `..._postcondition` functions in the example above) should take their arguments by `const&`, and when they are member functions they should be either `static` or `const` functions.
|
||||
* Similarly, exception guarantee functions (not shown in the example above) should take their arguments by `const&`, and when they are member functions they should be either `static` or `const` functions.
|
||||
* Old value functions (i.e., the `..._old` functions in the example above) should take their arguments by `const&` a part from old value pointers that should be taken by `&` (so only old value pointers can be modified), and when they are member functions they should be either `static` or `const` functions.
|
||||
* Constructor precondition, old value, and exception guarantee functions should be `static` (because there is no valid object `this` if the constructor body does not run successfully, see __Constructor_Calls__).
|
||||
* Destructor postcondition functions should be `static` (because there is no valid object `this` after the destructor body runs successfully, but exception guarantee functions do not have to be `static` since the object `this` is still valid because the destructor body did not run successfully, see __Destructor_Calls__).
|
||||
|
||||
Note that the extra contract functions also allow to keep the contract code in the header file while all function bodies are implemented in a separate source file (including the constructor member initialization list, that could not be done with the techniques shown in __Separate_Body_Implementation__).
|
||||
[footnote
|
||||
In this example, `bind` was used to generate nullary functors from the contract functions.
|
||||
As always with `bind`, `cref` and `ref` must be used to bind arguments by `const&` and `&` respectively, plus it might be necessary to explicitly `static_cast` the function pointer passed to `bind` for overloaded functions.
|
||||
]
|
||||
Also note that the contract functions can always be declared `private` if programmers need to exactly control the public members of the class (this was not done in this example only for brevity).
|
||||
|
||||
The authors think this library is most useful when used together with C++11 lambda functions.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section No Macros (and No Variadic Macros)]
|
||||
|
||||
It is possible to specify contracts without using most of the macros provided by this library and programming the related code manually instead (the only macros that cannot be programmed manually are [macroref BOOST_CONTRACT_OVERRIDE], [macroref BOOST_CONTRACT_OVERRIDES], and [macroref BOOST_CONTRACT_NAMED_OVERRIDE]).
|
||||
|
||||
[note
|
||||
Some of this library macros are variadic macros, others are not (see below).
|
||||
Variadic macros were officially added to the language in C++11 but most compilers have been supporting them as an extension for a long time, plus essentially all compilers that support C++11 lambda functions also support C++11 variadic macros (and this library might rarely be used without the convenience of C++11 lambda functions, see __No_Lambda_Functions__).
|
||||
[footnote
|
||||
Compilation times of this library were measured to be comparable between compilers that support variadic macros and compilers that do not.
|
||||
(See also [macroref BOOST_CONTRACT_MAX_ARGS] on compilers that do not support variadic macros.
|
||||
*Rationale:* [macroref BOOST_CONTRACT_MAX_ARGS] is named after `BOOST_FUNCTION_MAX_ARGS`.)
|
||||
]
|
||||
Therefore, the rest of this section can be considered mainly a curiosity because programmers should seldom need to use this library without using its macros.
|
||||
]
|
||||
|
||||
[heading Overrides]
|
||||
|
||||
As shown in __Public_Function_Overrides__ and __Named_Overrides__, this library provides the [macroref BOOST_CONTRACT_OVERRIDE] and [macroref BOOST_CONTRACT_NAMED_OVERRIDE] macros to program contracts for overriding public functions.
|
||||
These macros cannot be programmed manually but they are not variadic macros so programmers should be able to use them on all C++ compilers.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
These macros expand SFINAE-based introspection templates that are too complex to be programmed manually by users (that remains the case even if C++14 generic lambdas were to be used here).
|
||||
On a related note, in theory using C++14 generic lambdas, the [macroref BOOST_CONTRACT_OVERRIDE] macro could be re-implemented in a way that can be expanded at function scope, instead of class scope (but there is not really a need for that).
|
||||
]
|
||||
The [macroref BOOST_CONTRACT_OVERRIDES] macro is a variadic macro instead but programmes can manually repeat the non-variadic macro [macroref BOOST_CONTRACT_OVERRIDE] for each overriding public function name on compilers that do not support variadic macros.
|
||||
|
||||
[heading Assertions (Not Variadic)]
|
||||
|
||||
As shown in __Preconditions__, __Postconditions__, __Exception_Guarantees__, __Class_Invariants__, etc. this library provides the [macroref BOOST_CONTRACT_ASSERT] macro to assert contract conditions.
|
||||
This is not a variadic macro and programmers should be able to use it on all C++ compilers.
|
||||
In any case, the invocation `BOOST_CONTRACT_ASSERT(`[^['condition]]`)` expands to code equivalent to the following:
|
||||
[footnote
|
||||
*Rationale:*
|
||||
No need to also support C++11 `__func__` because this will always expand to the name of `operator()` of the functor used to program the contract assertions (e.g., of the lambda function) and it will not expand to the name of the actual function specifying the contract.
|
||||
]
|
||||
|
||||
if(!(``[^['condition]]``)) {
|
||||
throw boost::contract::assertion_failure(__FILE__, __LINE__,
|
||||
BOOST_PP_STRINGIZE(``[^['condition]]``));
|
||||
}
|
||||
|
||||
In fact, this library considers any exception thrown from within preconditions, postconditions, exception guarantees, and class invariants as a contract failure and reports it calling the related contract failure handler ([funcref boost::contract::precondition_failure], etc.).
|
||||
If there is a need for it, programmers can always program contract assertions that throw specific user-defined exceptions as follow (see __Throw_on_Failure__):
|
||||
|
||||
if(!``[^['condition]]``) throw ``[^['exception-object]]``;
|
||||
|
||||
However, using [macroref BOOST_CONTRACT_ASSERT] is convenient because it always allows this library to show an informative message in case of assertion failure containing the assertion code, file name and line number, etc.
|
||||
|
||||
The [macroref BOOST_CONTRACT_ASSERT_AUDIT] and [macroref BOOST_CONTRACT_ASSERT_AXIOM] macros are not a variadic macros and programmers should be able to use them on all C++ compilers.
|
||||
Their implements are equivalent to the following:
|
||||
|
||||
#ifdef BOOST_CONTRACT_AUDITS
|
||||
#define BOOST_CONTRACT_ASSERT_AUDIT(condition) \
|
||||
BOOST_CONTRACT_ASSERT(condition)
|
||||
#else
|
||||
#define BOOST_CONTRACT_ASSERT_AUDIT(condition) \
|
||||
BOOST_CONTRACT_ASSERT(true || (condition))
|
||||
#endif
|
||||
|
||||
#define BOOST_CONTRACT_ASSERT_AXIOM(condition) \
|
||||
BOOST_CONTRACT_ASSERT(true || (condition))
|
||||
|
||||
[heading Base Types (Variadic)]
|
||||
|
||||
As shown in __Base_Classes__, this library provides the [macroref BOOST_CONTRACT_BASE_TYPES] variadic macro to declare the `base_types` member type that will expand to the list of all public bases of a derived class.
|
||||
Programmers can also declare `base_types` without using [macroref BOOST_CONTRACT_BASE_TYPES] at the cost of writing a bit more code manually and increased maintenance.
|
||||
For example (see [@../../example/features/base_types_no_macro.cpp =base_types_no_macro.cpp=]):
|
||||
|
||||
[import ../example/features/base_types_no_macro.cpp]
|
||||
[base_types_no_macro]
|
||||
|
||||
The `base_types` member type must be a `boost::mpl::vector` which must list /all and only/ `public` base classes (because only public bases subcontract, see __Function_Calls__), and in the same order these public base classes appear in the derived class inheritance list.
|
||||
If the [macroref BOOST_CONTRACT_BASE_TYPES] macro is not used, it is the responsibility of the programmers to maintain the correct list of bases in the `boost::mpl::vector` each time the derived class inheritance list changes (this might significantly complicate maintenance).
|
||||
|
||||
In general, it is recommended to use the [macroref BOOST_CONTRACT_BASE_TYPES] macro whenever possible.
|
||||
|
||||
[heading Old Values (Variadic)]
|
||||
|
||||
As shown in __Old_Values__, this library provides the [macroref BOOST_CONTRACT_OLDOF] variadic macro to assign old value copies.
|
||||
Programmers can also assign old values without using [macroref BOOST_CONTRACT_OLDOF] at the cost of writing a bit more code manually.
|
||||
For example (see [@../../example/features/old_no_macro.cpp =old_no_macro.cpp=]):
|
||||
|
||||
[import ../example/features/old_no_macro.cpp]
|
||||
[old_no_macro]
|
||||
|
||||
The ternary operator `boost::contract::copy_old(v) ? size() : boost::contract::null_old()` must be used here to avoid evaluating and copying the old value expression `size()` when [funcref boost::contract::copy_old] returns `false` (because old values are not being copied when postcondition and exception guarantees checking is disabled at run-time, an overridden virtual function call is not checking postconditions or exception guarantees yet, etc.).
|
||||
The enclosing [funcref boost::contract::make_old] copies the old value expression and creates an old value pointer.
|
||||
Otherwise, [funcref boost::contract::null_old] indicates that a null old value pointer should be created.
|
||||
|
||||
The [funcref boost::contract::make_old] and [funcref boost::contract::copy_old] functions are used exactly as shown above but without the extra `v` parameter when they are called from within non-virtual functions (see __Public_Function_Overrides__).
|
||||
The old value pointer returned by [funcref boost::contract::make_old] can be assigned to either [classref boost::contract::old_ptr] or [classref boost::contract::old_ptr_if_copyable] (see __Old_Value_Requirements__).
|
||||
|
||||
In general, it is recommended to use the [macroref BOOST_CONTRACT_OLDOF] macro whenever possible.
|
||||
|
||||
[heading Macro Interface (Variadic)]
|
||||
|
||||
Almost all macros defined in [headerref boost/contract_macro.hpp] are variadic macros.
|
||||
On compilers that do not support variadic macros, programmers can manually disable contract code compilation using `#ifdef` statements as shown in __Disable_Contract_Compilation__.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Full Table of Contents]
|
||||
|
||||
[pre
|
||||
__Introduction__
|
||||
__Full_Table_of_Contents__
|
||||
__Getting_Started__
|
||||
__This_Documentation__
|
||||
__Compilers_and_Platforms__
|
||||
__Code_Organization__
|
||||
__Install_and_Compile__
|
||||
__Contract_Programming_Overview__
|
||||
__Assertions__
|
||||
__Benefits_and_Costs__
|
||||
__Function_Calls__
|
||||
__Public_Function_Calls__
|
||||
__Constructor_Calls__
|
||||
__Destructor_Calls__
|
||||
__Constant_Correctness__
|
||||
__Specification_vs_Implementation__
|
||||
__On_Contract_Failure__
|
||||
__Feature_Summary__
|
||||
__Tutorial__
|
||||
__Non_Member_Functions__
|
||||
__Preconditions__
|
||||
__Postconditions__
|
||||
__Return_Value__
|
||||
__Old_Values__
|
||||
__Exception_Guarantees__
|
||||
__Class_Invariants__
|
||||
__Constructors__
|
||||
__Destructors__
|
||||
__Public_Functions__
|
||||
__Virtual_Public_Functions__
|
||||
__Public_Function_Overrides_Subcontracting__
|
||||
__Base_Classes_Subcontracting__
|
||||
__Static_Public_Functions__
|
||||
__Advanced__
|
||||
__Pure_Virtual_Public_Functions__
|
||||
__Optional_Return_Value__
|
||||
__Private_and_Protected_Functions__
|
||||
__Friend_Functions__
|
||||
__Function_Overloads__
|
||||
__Lambdas_Loops_Code_Blocks_and_constexpr__
|
||||
__Implementation_Checks__
|
||||
__Old_Copies_at_Body__
|
||||
__Named_Overrides__
|
||||
__Access_Specifiers__
|
||||
__Throw_on_Failure_and_noexcept__
|
||||
__Extras__
|
||||
__Old_Value_Requirements_Templates__
|
||||
__Assertion_Requirements_Templates__
|
||||
__Volatile_Public_Functions__
|
||||
__Move_Operations__
|
||||
__Unions__
|
||||
__Disable_Contract_Checking__
|
||||
__Assertion_Levels__
|
||||
__Disable_Contract_Compilation_Macro_Interface__
|
||||
__Separate_Body_Implementation__
|
||||
__No_Lambda_Functions_No_CXX11__
|
||||
__No_Macros_and_No_Variadic_Macros__
|
||||
__Reference__
|
||||
__Examples__
|
||||
__Release_Notes__
|
||||
__Bibliography__
|
||||
__Acknowledgments__
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
|
||||
[/ Copyright (C) 2008-2017 Lorenzo Caminiti]
|
||||
[/ Distributed under the Boost Software License, Version 1.0 (see accompanying]
|
||||
[/ file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).]
|
||||
[/ See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html]
|
||||
|
||||
[section Getting Started]
|
||||
|
||||
This section illustrates how to setup a system to use this library.
|
||||
|
||||
[section This Documentation]
|
||||
|
||||
Programmers should be able to start using this library after reading __Introduction__, __Getting_Started__, and __Tutorial__.
|
||||
Other sections of this documentation (e.g., __Advanced__ and __Extras__) can be consulted at a later point to gain a more in-depth knowledge of the library.
|
||||
__Contract_Programming_Overview__ can be skipped by programmers that are already well familiar with the contract programming methodology.
|
||||
|
||||
Some of the source code of the examples linked by this documentation contain special code comments of the form `//[...` and `//]`.
|
||||
These mark sections of the code that are automatically extracted from the source and presented as part of this documentation.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
This allows to make sure that most of the example code presented in this documentation is always up-to-date, builds and runs with the latest implementation of the library.
|
||||
]
|
||||
Also the purpose of all examples in this documentation is to illustrate how to use this library and not to represent real product code.
|
||||
|
||||
Some footnotes are marked by the word "*Rationale*".
|
||||
These explain reasons behind decisions made during the design and implementation of this library.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Compilers and Platforms]
|
||||
|
||||
In general, this library requires a C++ compiler with support for SFINAE and other template meta-programming techniques part of the C++03 standard.
|
||||
This library requires Boost (Boost.Optional, Boost.Thread, Boost.FunctionTypes, Boost.Traits, Boost.MPL, etc.).
|
||||
|
||||
It is possible to use this library without C++11 lambda functions but a large amount of boiler-plate code is required to manually program separate functor to specify preconditions, postconditions, etc. (so using this library without C++11 lambda functions is possible but not recommended, see __No_Lambda_Functions__).
|
||||
It is also possible to use this library without variadic macros by manually programming a small amount of boiler-plate code (but most if not all modern C++ compilers support variadic macros even before C++99 and C++11 so this should never be needed in practice, see __No_Macros__).
|
||||
|
||||
Some parts of this documentation use an operator [^['type-of](...)] to indicate an operator logically equivalent to C++11 `decltype(...)`.
|
||||
However, this library implementation does not actually use type deduction in these cases (because the library already knows the types in question) so support for C++11 `decltype` and other type-of implementations are not actually required by this library (that is why [^['type-of]] and not the real `decltype` operator is used in this documentation).
|
||||
|
||||
This library has been developed and tested using:
|
||||
|
||||
* Visual Studio 2015 on Windows (MSVC =cl= version 19.00.24215.1).
|
||||
* GCC version 5.4.0 on Cygwin (with C++11 features enabled =-std=c++11=).
|
||||
* Clang version 3.8.1 on Cygwin (with C++11 features enabled =-std=c++11=).
|
||||
* Boost C++ libraries version 1.62.0.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Code Organization]
|
||||
|
||||
Let [^['lib-root]] be the directory under which this library source files have been installed.
|
||||
This library flies are organized as follows:
|
||||
|
||||
[pre
|
||||
['lib-root/] # Directory where this library files were installed.
|
||||
build/ # Build files (using Boost.Jam).
|
||||
doc/ # Documentation (using Boost.QuickBook).
|
||||
html/ # This documentation (HTML).
|
||||
example/ # Examples (including those listed in this documentation).
|
||||
include/
|
||||
boost/
|
||||
contract.hpp # Include all headers at once.
|
||||
contract/ # Header files to be included one-by-one.
|
||||
core/ # Fundamental headers (usually indirectly included by other headers).
|
||||
detail/ # Implementation code (should never be included or used directly).
|
||||
src/ # Library source code to be compiled.
|
||||
test/ # Tests.
|
||||
]
|
||||
|
||||
All headers required by this library can be included at once by:
|
||||
|
||||
#include <boost/contract.hpp>
|
||||
|
||||
Alternatively, all =boost/contract/*.hpp= headers are independent from one another and they can be selectively included one-by-one based on the specific functionality of this library being used (this might somewhat reduce compilation time).
|
||||
The =boost/contract/core/*.hpp= headers are not independent from other headers and they do not need to be directly included in user code when =boost/contract.hpp= or =boost/contract/*.hpp= headers are included already.
|
||||
|
||||
Files in =boost/contract/detail/=, names in the `boost::contract::detail` namespace, macros starting with `BOOST_CONTRACT_DETAIL...`, and all names starting with `boost_contract_detail...` (in any namespace, including user-defined namespaces) are part of this library implementation and should never be used directly in user code.
|
||||
|
||||
Names starting with `BOOST_CONTRACT_ERROR...` are used by this library to report some compile-time errors (so spotting these names in compiler error messages might help troubleshooting).
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Install and Compile]
|
||||
|
||||
Let [^['lib-root]] be the directory under which this library source files have been installed.
|
||||
Let [^['boost-root]] be the directory under which Boost source code has been installed and compiled following Boost's documentation (if pre-compiled Boost distributions are used instead, the [^['lib-boost]\/include] and [^['lib-boost]\/stage\/lib] directories below might be replaced by =/usr/include= and =/usr/lib= or similar directories depending on the specific Boost distribution, OS, etc.).
|
||||
|
||||
The steps below show how to compile this library as a shared library (a.k.a., Dynamically Linked Library or DLL) and then compile and run a sample program that uses this library (the [@../../example/features/introduction.cpp =introduction.cpp=] program shown in __Introduction__ is used as an example).
|
||||
|
||||
[warning
|
||||
By default, this library is compiled as a shared library (in which case this library automatically defines the [macroref BOOST_CONTRACT_DYN_LINK] macro).
|
||||
There are configuration macros [macroref BOOST_CONTRACT_STATIC_LINK] and [macroref BOOST_CONTRACT_HEADER_ONLY] that can be defined to compile this library as a static or header-only library respectively.
|
||||
[footnote
|
||||
*Rationale:*
|
||||
[macroref BOOST_CONTRACT_DYN_LINK], [macroref BOOST_CONTRACT_STATIC_LINK], and [macroref BOOST_CONTRACT_HEADER_ONLY] are named after `BOOST_ALL_DYN_LINK`, `BOOST_ALL_DYN_LINK`, and `BOOST_CHRONO_HEADER_ONLY` respectively.
|
||||
]
|
||||
|
||||
The use of [macroref BOOST_CONTRACT_STATIC_LINK] and [macroref BOOST_CONTRACT_HEADER_ONLY] is discouraged because this library is not guaranteed to always work correctly at run-time when these macros are defined.
|
||||
Specifically, this library might not correctly disable contracts while checking other contracts and call the correct user-defined contract failure handlers unless it is compiled as a shared library when it is being used by different program units (different programs, different shared libraries of the same program, etc.).
|
||||
However, [macroref BOOST_CONTRACT_STATIC_LINK] and [macroref BOOST_CONTRACT_HEADER_ONLY] can be used for applications that check contracts in a single program unit (e.g., a single program with only statically linked libraries that check contracts).
|
||||
]
|
||||
|
||||
[heading Visual Studio (MSVC)]
|
||||
|
||||
Using MSVC on Windows (from a developer command prompt that automatically invokes the correct =vcvarsall.bat=):
|
||||
|
||||
[pre
|
||||
> cd ['lib-root]\build
|
||||
> cl ['lib-root]\src\contract.cpp \/MDd \/EHs -I ['lib-root]\include -I ['boost-root] /link /DLL /LIBPATH:['boost-root]\stage\lib /out:boost_contract.dll
|
||||
]
|
||||
|
||||
[pre
|
||||
> cd ['lib-root]\example\features
|
||||
> cl introduction.cpp \/MDd \/EHs -I ['lib-root]\include -I ['boost-root] /link /LIBPATH:['boost-root]\stage\lib ['lib-root]\build\boost_contract.lib
|
||||
]
|
||||
|
||||
[pre
|
||||
> set PATH=%PATH%;['lib-root]\build
|
||||
> introduction
|
||||
]
|
||||
|
||||
[heading GCC and CLang]
|
||||
|
||||
Using GCC on Cygwin (or some Linux-like OS):
|
||||
|
||||
[pre
|
||||
$ cd ['lib-root]\/build
|
||||
$ g++ ['lib-root]\/src\/contract.cpp -std=c++11 -shared -I ['lib-root]\/include -I ['boost-root] ['boost-root]\/stage\/lib\/libboost_system.a -o boost_contract.dll
|
||||
]
|
||||
|
||||
[pre
|
||||
$ cd ['lib-root]\/example\/features
|
||||
$ g++ introduction.cpp -std=c++11 -I ['lib-root]\/include -I ['boost-root] ['lib-root]\/build\/boost_contract.dll -o introduction
|
||||
]
|
||||
|
||||
[pre
|
||||
$ export PATH=$PATH:['lib-root]\/build
|
||||
$ .\/introduction
|
||||
]
|
||||
|
||||
The above steps also work for Clang replacing =g++= with =clang++=.
|
||||
|
||||
[heading Boost.Build (BJam)]
|
||||
|
||||
Alternatively, programmers can setup their build environments (BJam, Make, CMake, MSBuild, etc.) to compile this library source code into a shared library and then compile and link user code against it (if that is preferred instead of manually running the compiler as indicated by the steps above).
|
||||
For example, this library source comes with a complete set of BJam files that can be used to build the library, build and run its tests and examples (see [@../../example/Jamfile.v2 =example/Jamfile.v2=], [@../../test/Jamfile.v2 =test/Jamfile.v2=], [@../../build/Jamfile.v2 =build/Jamfile.v2=], [@../../Jamroot =Jammroot=], [@../../build/boost_contract_no.jam =build/boost_contract_no.jam=], etc.).
|
||||
|
||||
Prior to running BJam, it is necessary to install and configure Boost from source.
|
||||
That can be done following these instructions for Windows (and similarly for Linux, see the [@http://www.boost.org/users/index.html Boost website]):
|
||||
|
||||
* Download the Boost source file for Windows [@http://www.boost.org/users/download/ [^boost_['version].zip]] and unzip it to some directory [^['boost-root]].
|
||||
* Run (from a developer command prompt that automatically invokes the correct =vcvarsall.bat=):
|
||||
|
||||
[pre
|
||||
> cd [^['boost-root]]
|
||||
> bootstrap.bat
|
||||
> b2
|
||||
]
|
||||
|
||||
* Create an environment variable named `BOOST_ROOT` and set it to the [^['boost-root]] directory path.
|
||||
* Add %BOOST_ROOT% to the end of the `PATH` environment variable (so `bjam` and other Boost tools can be found).
|
||||
|
||||
Boost and BJam are now ready to build this library.
|
||||
For example, the following uses BJam to build and run the [@../../example/features/introduction.cpp [^['lib-root]/example/features/introduction.cpp]] program and also to automatically build this library if necessary (from a developer command prompt that automatically invokes the correct =vcvarsall.bat=):
|
||||
|
||||
[pre
|
||||
> cd ['lib-root]\example
|
||||
> bjam features-introduction
|
||||
]
|
||||
|
||||
In addition, the following commands build this library, build and run all the examples and tests (from a developer command prompt that automatically invokes the correct =vcvarsall.bat=):
|
||||
|
||||
[pre
|
||||
> cd ['lib-root]\build # Build just the library (as a shared library by default).
|
||||
> bjam
|
||||
|
||||
> cd ['lib-root]\example # Build and run all examples (also automatically build the library if needed).
|
||||
> bjam
|
||||
|
||||
> cd ['lib-root]\test # Build and run all tests (also automatically build the library if needed).
|
||||
> bjam
|
||||
]
|
||||
|
||||
From the example and test directories =bjam help= gives a list of options to build and run examples and tests individually, with some contracts turned off, using different compilers, with this library as a static or header-only library, etc.
|
||||
|
||||
[heading Boost.QuickBook (This Documentation)]
|
||||
|
||||
In general users will not need to rebuild this document so they can skip this section.
|
||||
|
||||
Prior to running BJam to rebuild this documentation and regenerate its HTML pages, it is necessary to install and configure Boost from source as explained in the section above.
|
||||
In addition, it is necessary to download and configure tools required by Boost.QuickBook as explained on the [@http://www.boost.org/doc/libs/release/doc/html/quickbook/install.html Boost.QuickBook website].
|
||||
Finally, it is necessary to install [@http://www.stack.nl/~dimitri/doxygen/download.html Doxygen] to some directory [^['doxygen-root]] and add the following to the =user-config.jam= file in your home directory (for example for Windows, but similarly for Linux, etc.):
|
||||
|
||||
[pre
|
||||
using doxygen : "['doxygen-root]/bin/doxygen.exe" ;
|
||||
]
|
||||
|
||||
Boost.QuickBook and BJam are now ready to rebuild this documentation and generate its HTML pages under the directory [^['lib-root]\doc\html]:
|
||||
[footnote
|
||||
In theory, it is possible to use Boost.QuickBook to build this documentation into a single PDF file instead of HTML pages, running =bjam pdf= from within the [^['lib-root]\doc] directory.
|
||||
For that, Apache FOP and Java need to be installed as explained on the [@http://www.boost.org/doc/libs/1_65_0/doc/html/boostbook/getting/started.html Boost.Book website] and a command similar to =using fop : "C:/PROGRA~1/RenderX/XEP/xep.bat -valid" : "C:/PROGRA~1/Java/jre7/bin" ;= needs to be added to =user-config.jam= (actual paths might different on specific installations).
|
||||
However, this is not configured by default and it might require extra effort to ensure that all links, code listings, tables, images, etc. correctly show in the generated PDF file.
|
||||
]
|
||||
|
||||
[pre
|
||||
> cd ['lib-root]\doc # Build this documentation.
|
||||
> bjam
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html" title="Macro BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION">
|
||||
<link rel="next" href="BOOST_CONTRACT_AUDITS.html" title="Macro BOOST_CONTRACT_AUDITS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_AUDITS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION</span></h2>
|
||||
<p>BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION — Define this macro to not disable any assertions while checking any other assertion (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154752"></a><h2>Description</h2>
|
||||
<p>Not disabling assertions while checking other assertions can lead to infinite recursion in user code so by default this macro is not defined. (Defining this macro automatically implies that other assertion checking is disabled while checking preconditions as if <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html" title="Macro BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION">BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION</a></code> was also defined.)</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/contract_programming_overview.html#boost_contract.contract_programming_overview.feature_summary" title="Feature Summary">
|
||||
Feature Summary</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_AUDITS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_ASSERT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">
|
||||
<link rel="prev" href="reference.html" title="Reference">
|
||||
<link rel="next" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="reference.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ASSERT_AUDIT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_ASSERT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_ASSERT</span></h2>
|
||||
<p>BOOST_CONTRACT_ASSERT — Preferred way to assert contract conditions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">boost/contract/assert.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_ASSERT(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1136956"></a><h2>Description</h2>
|
||||
<p>Any exception thrown from within a contract (preconditions, postconditions, exception guarantees, old value copies at body, class invariants, etc.) is interpreted by this library as a contract failure. Therefore, users can program contract assertions manually throwing an exception when an asserted condition is checked to be <code class="computeroutput">false</code> (this library will then call the appropriate contract failure handler <code class="computeroutput"><a class="link" href="boost/contract/precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code>, etc.). However, it is preferred to use this macro because it expands to code that throws <code class="computeroutput"><a class="link" href="boost/contract/assertion_failure.html" title="Class assertion_failure">boost::contract::assertion_failure</a></code> with the correct assertion file name (using <code class="computeroutput">__FILE__</code>), line number (using <code class="computeroutput">__LINE__</code>), and asserted condition code so to produce informative error messages.</p>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">BOOST_CONTRACT_ASSERT_AUDIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AXIOM.html" title="Macro BOOST_CONTRACT_ASSERT_AXIOM">BOOST_CONTRACT_ASSERT_AXIOM</a></code> are the three assertion levels predefined by this library.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.preconditions" title="Preconditions"> Preconditions</a>, <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.postconditions" title="Postconditions"> Postconditions</a>, <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exceptions Guarantees</a>, <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean contract condition to check. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_ASSERT((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="reference.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ASSERT_AUDIT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_ASSERT_AUDIT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">
|
||||
<link rel="next" href="BOOST_CONTRACT_ASSERT_AXIOM.html" title="Macro BOOST_CONTRACT_ASSERT_AXIOM">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ASSERT_AXIOM.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_ASSERT_AUDIT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_ASSERT_AUDIT</span></h2>
|
||||
<p>BOOST_CONTRACT_ASSERT_AUDIT — Preferred way to assert contract conditions that are computationally expensive, at least compared to the cost of executing the function body. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">boost/contract/assert.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_ASSERT_AUDIT(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1140064"></a><h2>Description</h2>
|
||||
<p>The asserted condition will always be compiled and validated syntactically, but it will not be evaluated at run-time unless <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_AUDITS.html" title="Macro BOOST_CONTRACT_AUDITS">BOOST_CONTRACT_AUDITS</a></code> is defined (undefined by default).</p>
|
||||
<p>This macro is defined by code equivalent to:</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_CONTRACT_AUDITS</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_ASSERT_AUDIT</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_ASSERT</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_ASSERT_AUDIT</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_ASSERT</span><span class="special">(</span><span class="keyword">true</span> <span class="special">||</span> <span class="identifier">cond</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">BOOST_CONTRACT_ASSERT_AUDIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AXIOM.html" title="Macro BOOST_CONTRACT_ASSERT_AXIOM">BOOST_CONTRACT_ASSERT_AXIOM</a></code> are the three assertion levels predefined by this library. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.assertion_levels" title="Assertion Levels"> Assertions Levels</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean contract condition to check. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_ASSERT_AUDIT((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ASSERT_AXIOM.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_ASSERT_AXIOM</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">
|
||||
<link rel="next" href="BOOST_CONTRACT_BASE_TYPES.html" title="Macro BOOST_CONTRACT_BASE_TYPES">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT_AUDIT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_BASE_TYPES.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_ASSERT_AXIOM"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_ASSERT_AXIOM</span></h2>
|
||||
<p>BOOST_CONTRACT_ASSERT_AXIOM — Preferred way to assert contract conditions that are computationally prohibitive, at least compared to the cost of executing the function body. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.assert_hpp" title="Header <boost/contract/assert.hpp>">boost/contract/assert.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_ASSERT_AXIOM(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1140291"></a><h2>Description</h2>
|
||||
<p>The asserted condition will always be compiled and validated syntactically, but it will never be evaluated at run-time.</p>
|
||||
<p>This macro is defined by code equivalent to:</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_ASSERT_AXIOM</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_ASSERT</span><span class="special">(</span><span class="keyword">true</span> <span class="special">||</span> <span class="identifier">cond</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">BOOST_CONTRACT_ASSERT_AUDIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AXIOM.html" title="Macro BOOST_CONTRACT_ASSERT_AXIOM">BOOST_CONTRACT_ASSERT_AXIOM</a></code> are the three assertion levels predefined by this library. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.assertion_levels" title="Assertion Levels"> Assertion Levels</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean contract condition to check. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_ASSERT_AXIOM((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT_AUDIT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.assert_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_BASE_TYPES.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_AUDITS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html" title="Macro BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_CHECKS.html" title="Macro BOOST_CONTRACT_NO_CHECKS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CHECKS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_AUDITS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_AUDITS</span></h2>
|
||||
<p>BOOST_CONTRACT_AUDITS — Define this macro to evaluate and check audit assertions at run-time (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_AUDITS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154839"></a><h2>Description</h2>
|
||||
<p>Audit assertions and implementation checks programmed via <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT_AUDIT.html" title="Macro BOOST_CONTRACT_ASSERT_AUDIT">BOOST_CONTRACT_ASSERT_AUDIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">BOOST_CONTRACT_CHECK_AUDIT</a></code> are always compiled and validated syntactically. However, they are not evaluated and checked at run-time unless this macro is defined (because these conditions can be computationally expensive, at least compared to the cost of executing the function body).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.assertion_levels" title="Assertion Levels"> Assertion Levels</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CHECKS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_BASES_TYPEDEF</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_MAX_ARGS.html" title="Macro BOOST_CONTRACT_MAX_ARGS">
|
||||
<link rel="next" href="BOOST_CONTRACT_INVARIANT_FUNC.html" title="Macro BOOST_CONTRACT_INVARIANT_FUNC">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_MAX_ARGS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT_FUNC.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_BASES_TYPEDEF"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_BASES_TYPEDEF</span></h2>
|
||||
<p>BOOST_CONTRACT_BASES_TYPEDEF — Define the name of the base type <code class="computeroutput">typedef</code> (<code class="computeroutput">base_types</code> by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_BASES_TYPEDEF</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151843"></a><h2>Description</h2>
|
||||
<p>This macro expands to the name of the <code class="computeroutput">typedef</code> that lists the base classes for subcontracting via <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_BASE_TYPES.html" title="Macro BOOST_CONTRACT_BASE_TYPES">BOOST_CONTRACT_BASE_TYPES</a></code>. This macro can be defined if the <code class="computeroutput">typedef</code> must have a name different from <code class="computeroutput">base_types</code> (because of name clashes in user code, etc.).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.base_classes__subcontracting_" title="Base Classes (Subcontracting)"> Base Classes</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_MAX_ARGS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT_FUNC.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_BASE_TYPES</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.base_types_hpp" title="Header <boost/contract/base_types.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_ASSERT_AXIOM.html" title="Macro BOOST_CONTRACT_ASSERT_AXIOM">
|
||||
<link rel="next" href="boost/contract/call_if_statement.html" title="Struct template call_if_statement">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT_AXIOM.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.base_types_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/call_if_statement.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_BASE_TYPES"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_BASE_TYPES</span></h2>
|
||||
<p>BOOST_CONTRACT_BASE_TYPES — Used to program a <code class="computeroutput">typedef</code> listing the bases of a derived class. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.base_types_hpp" title="Header <boost/contract/base_types.hpp>">boost/contract/base_types.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_BASE_TYPES(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1140449"></a><h2>Description</h2>
|
||||
<p>In order to support subcontracting, a derived class that specifies contracts for one or more overriding public function must declare a <code class="computeroutput">typedef</code> named <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_BASES_TYPEDEF.html" title="Macro BOOST_CONTRACT_BASES_TYPEDEF">BOOST_CONTRACT_BASES_TYPEDEF</a></code> using this macro. This <code class="computeroutput">typedef</code> must be <code class="computeroutput">public</code> unless <code class="computeroutput"><a class="link" href="boost/contract/access.html" title="Class access">boost::contract::access</a></code> is used.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.base_classes__subcontracting_" title="Base Classes (Subcontracting)"> Base Classes</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">...</code></span></p></td>
|
||||
<td><p>Comma separated list of base classes. Each base must explicitly specify its access specifier <code class="computeroutput">public</code>, <code class="computeroutput">protected</code>, or <code class="computeroutput">private</code>, and also <code class="computeroutput">virtual</code> when present (this not always required in C++ instead). There is a limit of about 20 maximum bases that can be listed (because of similar limits in Boost.MPL internally used by this library). This is a variadic macro parameter, on compilers that do not support variadic macros, the <code class="computeroutput">typedef</code> for base classes can be programmed manually without using this macro. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ASSERT_AXIOM.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.base_types_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/call_if_statement.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_CHECK</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">
|
||||
<link rel="prev" href="boost/contract/access.html" title="Class access">
|
||||
<link rel="next" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/access.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CHECK_AUDIT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_CHECK"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_CHECK</span></h2>
|
||||
<p>BOOST_CONTRACT_CHECK — Preferred way to assert implementation check conditions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">boost/contract/core/check_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_CHECK(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153237"></a><h2>Description</h2>
|
||||
<p>It is preferred to use this macro instead of programming implementation checks in a nullary functor passed to <code class="computeroutput"><a class="link" href="boost/contract/check.html" title="Class check">boost::contract::check</a></code> constructor because this macro will completely remove implementation checks from the code when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_CHECKS.html" title="Macro BOOST_CONTRACT_NO_CHECKS">BOOST_CONTRACT_NO_CHECKS</a></code> is defined.</p>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">BOOST_CONTRACT_CHECK</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">BOOST_CONTRACT_CHECK_AUDIT</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AXIOM.html" title="Macro BOOST_CONTRACT_CHECK_AXIOM">BOOST_CONTRACT_CHECK_AXIOM</a></code> are the three assertion levels predefined by this library.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks"> Implementation Checks</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean condition to check within implementation code (function body, etc.). (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_CHECK((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/access.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CHECK_AUDIT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_CHECK_AUDIT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">
|
||||
<link rel="next" href="BOOST_CONTRACT_CHECK_AXIOM.html" title="Macro BOOST_CONTRACT_CHECK_AXIOM">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CHECK_AXIOM.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_CHECK_AUDIT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_CHECK_AUDIT</span></h2>
|
||||
<p>BOOST_CONTRACT_CHECK_AUDIT — Preferred way to assert implementation check conditions that are computationally expensive, at least compared to the cost of executing the function body. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">boost/contract/core/check_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_CHECK_AUDIT(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153334"></a><h2>Description</h2>
|
||||
<p>The specified condition will always be compiled and validated syntactically, but it will not be evaluated at run-time unless <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_AUDITS.html" title="Macro BOOST_CONTRACT_AUDITS">BOOST_CONTRACT_AUDITS</a></code> is defined (undefined by default).</p>
|
||||
<p>This macro is defined by code equivalent to:</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_CONTRACT_AUDITS</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_CHECK_AUDIT</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_CHECK</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_CHECK_AUDIT</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_CHECK</span><span class="special">(</span><span class="keyword">true</span> <span class="special">||</span> <span class="identifier">cond</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">BOOST_CONTRACT_CHECK</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">BOOST_CONTRACT_CHECK_AUDIT</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AXIOM.html" title="Macro BOOST_CONTRACT_CHECK_AXIOM">BOOST_CONTRACT_CHECK_AXIOM</a></code> are the three assertion levels predefined by this library. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.assertion_levels" title="Assertion Levels"> Assertion Levels</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean condition to check within implementation code (function body, etc.). (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_CHECK((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CHECK_AXIOM.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_CHECK_AXIOM</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">
|
||||
<link rel="next" href="BOOST_CONTRACT_STATIC_LINK.html" title="Macro BOOST_CONTRACT_STATIC_LINK">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK_AUDIT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_LINK.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_CHECK_AXIOM"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_CHECK_AXIOM</span></h2>
|
||||
<p>BOOST_CONTRACT_CHECK_AXIOM — Preferred way to assert implementation check conditions that are computationally prohibitive, at least compared to the cost of executing the function body. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.check_macro_hpp" title="Header <boost/contract/core/check_macro.hpp>">boost/contract/core/check_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_CHECK_AXIOM(cond)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153538"></a><h2>Description</h2>
|
||||
<p>The specified condition will always be compiled and validated syntactically, but it will never be evaluated at run-time.</p>
|
||||
<p>This macro is defined by code equivalent to:</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_CONTRACT_CHECK_AXIOM</span><span class="special">(</span><span class="identifier">cond</span><span class="special">)</span> \
|
||||
<span class="identifier">BOOST_CONTRACT_CHECK</span><span class="special">(</span><span class="keyword">true</span> <span class="special">||</span> <span class="identifier">cond</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p> <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">BOOST_CONTRACT_CHECK</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AUDIT.html" title="Macro BOOST_CONTRACT_CHECK_AUDIT">BOOST_CONTRACT_CHECK_AUDIT</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK_AXIOM.html" title="Macro BOOST_CONTRACT_CHECK_AXIOM">BOOST_CONTRACT_CHECK_AXIOM</a></code> are the three assertion levels predefined by this library. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.assertion_levels" title="Assertion Levels"> Assertion Levels</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">cond</code></span></p></td>
|
||||
<td><p>Boolean condition to check within implementation code (function body, etc.). (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_CHECK((cond))</code> will always work.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK_AUDIT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.check_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_LINK.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_CONSTRUCTOR</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_STATIC_INVARIANT.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT">
|
||||
<link rel="next" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_INVARIANT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_CONSTRUCTOR"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_CONSTRUCTOR</span></h2>
|
||||
<p>BOOST_CONTRACT_CONSTRUCTOR — Program contracts that can be completely disabled at compile-time for constructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_CONSTRUCTOR(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186339"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_CONSTRUCTOR(obj)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_CONSTRUCTORS">BOOST_CONTRACT_NO_CONSTRUCTORS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_CONSTRUCTORS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">constructor</span><span class="special">(</span><span class="identifier">obj</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>obj</strong></span></code> is the object <code class="computeroutput">this</code> from the scope of the enclosing constructor declaring the contract. Constructors check all class invariants, including static and volatile invariants (see <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants">
|
||||
Class Invariants</a> and <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.constructors" title="Constructors"> Constructors</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION">BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION</a></code> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_INVARIANT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_CONSTRUCTOR.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR">
|
||||
<link rel="next" href="BOOST_CONTRACT_DESTRUCTOR.html" title="Macro BOOST_CONTRACT_DESTRUCTOR">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CONSTRUCTOR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DESTRUCTOR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION</span></h2>
|
||||
<p>BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION — Program preconditions that can be disabled at compile-time for constructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186525"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION(Class)(f)</code> expands to code equivalent to the following (note that when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code> is defined, this macro trivially expands to a default constructor call that is internally implemented to do nothing so this should have minimal to no overhead):</p>
|
||||
<pre class="programlisting"><span class="comment">// Guarded only by NO_PRECONDITIONS (and not also by NO_CONSTRUCTORS)</span>
|
||||
<span class="comment">// because for constructor's preconditions (not for postconditions, etc.).</span>
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PRECONDITIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">constructor_precondition</span><span class="special"><</span><span class="identifier">Class</span><span class="special">></span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
|
||||
<span class="preprocessor">#else</span>
|
||||
<span class="comment">// No-op call (likely optimized away, minimal to no overhead).</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">constructor_precondition</span><span class="special"><</span><span class="identifier">Class</span><span class="special">></span><span class="special">(</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>Class</strong></span></code> is the type of the class containing the constructor for which preconditions are being programmed. (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is the nullary functor called by this library to check constructor preconditions <code class="computeroutput">f()</code>. Assertions within this functor call are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this functor indicates a contract failure (and will result in this library calling <code class="computeroutput"><a class="link" href="boost/contract/precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code>). This functor should capture variables by (constant) value, or better by (constant) reference to avoid extra copies. (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.constructors" title="Constructors"> Constructors</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CONSTRUCTOR.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR">BOOST_CONTRACT_CONSTRUCTOR</a></code> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CONSTRUCTOR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DESTRUCTOR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_DESTRUCTOR</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION">
|
||||
<link rel="next" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html" title="Macro BOOST_CONTRACT_PUBLIC_FUNCTION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_DESTRUCTOR"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_DESTRUCTOR</span></h2>
|
||||
<p>BOOST_CONTRACT_DESTRUCTOR — Program contracts that can be completely disabled at compile-time for destructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_DESTRUCTOR(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186773"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_DESTRUCTOR(obj)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_DESTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_DESTRUCTORS">BOOST_CONTRACT_NO_DESTRUCTORS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_DESTRUCTORS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">destructor</span><span class="special">(</span><span class="identifier">obj</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>obj</strong></span></code> is the object <code class="computeroutput">this</code> from the scope of the enclosing destructor declaring the contract. Destructors check all class invariants, including static and volatile invariants (see <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants">
|
||||
Class Invariants</a> and <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.destructors" title="Destructors"> Destructors</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CONSTRUCTOR_PRECONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_DISABLE_THREADS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_HEADER_ONLY.html" title="Macro BOOST_CONTRACT_HEADER_ONLY">
|
||||
<link rel="next" href="BOOST_CONTRACT_MAX_ARGS.html" title="Macro BOOST_CONTRACT_MAX_ARGS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_HEADER_ONLY.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_MAX_ARGS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_DISABLE_THREADS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_DISABLE_THREADS</span></h2>
|
||||
<p>BOOST_CONTRACT_DISABLE_THREADS — Define this macro to not lock internal library data for thread safety (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_DISABLE_THREADS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151699"></a><h2>Description</h2>
|
||||
<p>Defining this macro will make the library implementation code not thread safe so this macro should not be defined unless the library is being used by single-threaded applications only.</p>
|
||||
<p>However, when this macro is left undefined this library needs to internally use some sort of "global" lock (to ensure contract checking is globally disabled when other contracts are being checked and also to safely access failure handler functors). That could introduce an undesired amount of synchronization in some multi-threaded applications.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/contract_programming_overview.html#boost_contract.contract_programming_overview.assertions" title="Assertions"> Assertions</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_HEADER_ONLY.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_MAX_ARGS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_DYN_LINK</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_ALL.html" title="Macro BOOST_CONTRACT_NO_ALL">
|
||||
<link rel="next" href="boost/contract/constructor_precondition.html" title="Class template constructor_precondition">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_ALL.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/constructor_precondition.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_DYN_LINK"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_DYN_LINK</span></h2>
|
||||
<p>BOOST_CONTRACT_DYN_LINK — Automatically defined when this library is being compiled as a shared library (defined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_DYN_LINK</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153990"></a><h2>Description</h2>
|
||||
<p>This library will define this macro unless users define <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_STATIC_LINK.html" title="Macro BOOST_CONTRACT_STATIC_LINK">BOOST_CONTRACT_STATIC_LINK</a></code> or <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_HEADER_ONLY.html" title="Macro BOOST_CONTRACT_HEADER_ONLY">BOOST_CONTRACT_HEADER_ONLY</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Programmers should rarely, if ever, need to use this macro directly.</p>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>In general this library will correctly check contracts at run-time only when compiled as a shared library (i.e., this macro will be automatically defined by default), unless user code checks contracts in a single program unit (e.g., a single program with only statically linked libraries that check contracts).</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/getting_started.html#boost_contract.getting_started.install_and_compile" title="Install and Compile"> Install and Compile</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_ALL.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/constructor_precondition.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_EXCEPT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_POSTCONDITION.html" title="Macro BOOST_CONTRACT_POSTCONDITION">
|
||||
<link rel="next" href="BOOST_CONTRACT_OLD.html" title="Macro BOOST_CONTRACT_OLD">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_POSTCONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_EXCEPT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_EXCEPT</span></h2>
|
||||
<p>BOOST_CONTRACT_EXCEPT — Program exception guarantees that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_EXCEPT(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1181945"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_EXCEPT(f)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_EXCEPTS</span>
|
||||
<span class="special">.</span><span class="identifier">except</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is the nullary functor called by this library to check exception guarantees <code class="computeroutput">f()</code>. Assertions within this functor are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling <code class="computeroutput"><a class="link" href="boost/contract/except_failure.html" title="Function except_failure">boost::contract::except_failure</a></code>). This functor should capture variables by (constant) references (to access the values they will have at function exit). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exception Guarantees</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_POSTCONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_FUNCTION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html" title="Macro BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION">
|
||||
<link rel="next" href="boost_contract/release_notes.html" title="Release Notes">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost_contract/release_notes.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_FUNCTION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_FUNCTION</span></h2>
|
||||
<p>BOOST_CONTRACT_FUNCTION — Program contracts that can be completely disabled at compile-time for (non-public) functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_FUNCTION()</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1187766"></a><h2>Description</h2>
|
||||
<p>This can be used to program contracts for non-member functions but also for private and protected functions, lambda functions, loops, arbitrary blocks of code, etc.</p>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_FUNCTION()</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_FUNCTIONS">BOOST_CONTRACT_NO_FUNCTIONS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">function</span><span class="special">(</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.non_member_functions" title="Non-Member Functions"> Non-Member Functions</a>, <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.private_and_protected_functions" title="Private and Protected Functions">
|
||||
Private and Protected Functions</a>, <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.lambdas__loops__code_blocks__and__constexpr__" title="Lambdas, Loops, Code Blocks (and constexpr)">
|
||||
Lambdas, Loops, Code Blocks</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost_contract/release_notes.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_HEADER_ONLY</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_STATIC_LINK.html" title="Macro BOOST_CONTRACT_STATIC_LINK">
|
||||
<link rel="next" href="BOOST_CONTRACT_DISABLE_THREADS.html" title="Macro BOOST_CONTRACT_DISABLE_THREADS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_LINK.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DISABLE_THREADS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_HEADER_ONLY"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_HEADER_ONLY</span></h2>
|
||||
<p>BOOST_CONTRACT_HEADER_ONLY — Define this macro to use this library as a header-only library (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_HEADER_ONLY</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151660"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library does not have to be compiled separately from user code. This library headers are simply included and compiled as part of the user program.</p>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>This library is not guaranteed to always work correctly at run-time when this macro is defined. However, this macro can be defined and this library can be safely used as a header-only library for user code that checks contracts in a single program unit (e.g., a single program with only statically linked libraries that check contracts).</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/getting_started.html#boost_contract.getting_started.install_and_compile" title="Install and Compile"> Install and Compile</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_LINK.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DISABLE_THREADS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_INVARIANT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html" title="Macro BOOST_CONTRACT_OLD_PTR_IF_COPYABLE">
|
||||
<link rel="next" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html" title="Macro BOOST_CONTRACT_INVARIANT_VOLATILE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_INVARIANT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_INVARIANT</span></h2>
|
||||
<p>BOOST_CONTRACT_INVARIANT — Program (constant) class invariants that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_INVARIANT(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1185784"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_INVARIANT</code>({ ... }) expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_INVARIANTS</span>
|
||||
<span class="keyword">void</span> <span class="identifier">BOOST_CONTRACT_INVARIANT_FUNC</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="bold"><strong>{ ... }</strong></span> is the definition of the function that checks class invariants for public functions that are not static and not volatile (see <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_STATIC_INVARIANT.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT">BOOST_CONTRACT_STATIC_INVARIANT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html" title="Macro BOOST_CONTRACT_INVARIANT_VOLATILE">BOOST_CONTRACT_INVARIANT_VOLATILE</a></code>). Assertions within this function are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this function indicates a contract assertion failure (and will result in this library calling either <code class="computeroutput"><a class="link" href="boost/contract/entry_invariant_failure.html" title="Function entry_invariant_failure">boost::contract::entry_invariant_failure</a></code> or <code class="computeroutput"><a class="link" href="boost/contract/exit_invariant_failure.html" title="Function exit_invariant_failure">boost::contract::exit_invariant_failure</a></code>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_INVARIANT_FUNC</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_BASES_TYPEDEF.html" title="Macro BOOST_CONTRACT_BASES_TYPEDEF">
|
||||
<link rel="next" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT_FUNC">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_BASES_TYPEDEF.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_INVARIANT_FUNC"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_INVARIANT_FUNC</span></h2>
|
||||
<p>BOOST_CONTRACT_INVARIANT_FUNC — Define the name of the class invariant member function (<code class="computeroutput">invariant</code> by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_INVARIANT_FUNC</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151912"></a><h2>Description</h2>
|
||||
<p>This macro expands to the name of the <code class="computeroutput">const</code> and <code class="computeroutput">const volatile</code> member functions that check class invariants and volatile class invariants respectively. This macro can be defined if these invariant functions must have a name different from <code class="computeroutput">invariant</code> (because of name clashes in user code, etc.).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_BASES_TYPEDEF.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_INVARIANT_VOLATILE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_INVARIANT.html" title="Macro BOOST_CONTRACT_INVARIANT">
|
||||
<link rel="next" href="BOOST_CONTRACT_STATIC_INVARIANT.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_INVARIANT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_INVARIANT_VOLATILE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_INVARIANT_VOLATILE</span></h2>
|
||||
<p>BOOST_CONTRACT_INVARIANT_VOLATILE — Program volatile class invariants that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_INVARIANT_VOLATILE(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186005"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_INVARIANT_VOLATILE</code>({ ... }) expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_INVARIANTS</span>
|
||||
<span class="keyword">void</span> <span class="identifier">BOOST_CONTRACT_INVARIANT_FUNC</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">volatile</span> <span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="bold"><strong>{ ... }</strong></span> is the definition of the function that checks class invariants for volatile public functions (see <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_INVARIANT.html" title="Macro BOOST_CONTRACT_INVARIANT">BOOST_CONTRACT_INVARIANT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_STATIC_INVARIANT.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT">BOOST_CONTRACT_STATIC_INVARIANT</a></code>). Assertions within this function are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this function indicates a contract assertion failure (and will result in this library calling either <code class="computeroutput"><a class="link" href="boost/contract/entry_invariant_failure.html" title="Function entry_invariant_failure">boost::contract::entry_invariant_failure</a></code> or <code class="computeroutput"><a class="link" href="boost/contract/exit_invariant_failure.html" title="Function exit_invariant_failure">boost::contract::exit_invariant_failure</a></code>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_INVARIANT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_MAX_ARGS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_DISABLE_THREADS.html" title="Macro BOOST_CONTRACT_DISABLE_THREADS">
|
||||
<link rel="next" href="BOOST_CONTRACT_BASES_TYPEDEF.html" title="Macro BOOST_CONTRACT_BASES_TYPEDEF">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_DISABLE_THREADS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_BASES_TYPEDEF.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_MAX_ARGS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_MAX_ARGS</span></h2>
|
||||
<p>BOOST_CONTRACT_MAX_ARGS — Maximum number of function arguments on compilers that do not support variadic macros (default to <code class="computeroutput">10</code>). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_MAX_ARGS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151764"></a><h2>Description</h2>
|
||||
<p>On compilers that support variadic macros, this macro has no effect. On compilers that do not support variadic macros, this macro can be defined to the maximum number of arguments that public function overrides can have and pass to <code class="computeroutput"><a class="link" href="boost/contract/public_function_id548174.html" title="Function template public_function">boost::contract::public_function</a></code>.</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>Regardless of the value of this macro and of compiler support for variadic macros, there is an intrinsic limit of about 18 arguments for public function overrides (because of similar limits in Boost.MPL and Boost.FunctionTypes internally used by this library).</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.no_macros__and_no_variadic_macros_" title="No Macros (and No Variadic Macros)"> No Macros</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_DISABLE_THREADS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_BASES_TYPEDEF.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NAMED_OVERRIDE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_OLDOF.html" title="Macro BOOST_CONTRACT_OLDOF">
|
||||
<link rel="next" href="BOOST_CONTRACT_OVERRIDE.html" title="Macro BOOST_CONTRACT_OVERRIDE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLDOF.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NAMED_OVERRIDE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NAMED_OVERRIDE</span></h2>
|
||||
<p>BOOST_CONTRACT_NAMED_OVERRIDE — Declare an override type with an arbitrary name. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">boost/contract/override.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NAMED_OVERRIDE(override_name, function_name)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177715"></a><h2>Description</h2>
|
||||
<p>Declare the override type to pass as an explicit template parameter to <code class="computeroutput"><a class="link" href="boost/contract/public_function_id548174.html" title="Function template public_function">boost::contract::public_function</a></code> for public function overrides.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.named_overrides" title="Named Overrides"> Named Overrides</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">function_name</code></span></p></td>
|
||||
<td><p>Function name of the public function override. This macro is called just once even if the function name is overloaded (the same override type is used for all overloaded functions with the same name, see <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.function_overloads" title="Function Overloads">
|
||||
Function Overloads</a>). (This is not a variadic macro parameter but it should never contain commas because it is an identifier.) </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">override_name</code></span></p></td>
|
||||
<td><p>Name of the override type this macro will declare. (This is not a variadic macro parameter but it should never contain commas because it is an identifier.) </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLDOF.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_ALL</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_CONDITIONS.html" title="Macro BOOST_CONTRACT_NO_CONDITIONS">
|
||||
<link rel="next" href="BOOST_CONTRACT_DYN_LINK.html" title="Macro BOOST_CONTRACT_DYN_LINK">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DYN_LINK.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_ALL"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_ALL</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_ALL — Automatically defined by this library when contracts are not checked at all. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_ALL</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153805"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_CHECKS.html" title="Macro BOOST_CONTRACT_NO_CHECKS">BOOST_CONTRACT_NO_CHECKS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). For example, users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to avoid including the <code class="computeroutput">boost/contract.hpp</code> header all together:</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">contract</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_ALL</span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">contract</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Or, use the <code class="computeroutput">boost/contract_macro.hpp</code> header and related macros instead (because the <code class="computeroutput">boost/contract/_macro.hpp</code> header is already optimized to not include other headers from this library when contracts are not checked, but recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_DYN_LINK.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_CHECKS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_AUDITS.html" title="Macro BOOST_CONTRACT_AUDITS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_AUDITS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_PRECONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_CHECKS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_CHECKS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_CHECKS — If defined, this library does not perform implementation checks (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_CHECKS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154852"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with implementation checks. Use <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">BOOST_CONTRACT_CHECK</a></code> to completely disable compilation of implementation checks when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_CHECKS.html" title="Macro BOOST_CONTRACT_NO_CHECKS">BOOST_CONTRACT_NO_CHECKS</a></code> is defined.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks">
|
||||
Implementation Checks</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_AUDITS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_PRECONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_CONDITIONS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_FUNCTIONS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_ALL.html" title="Macro BOOST_CONTRACT_NO_ALL">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_FUNCTIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_ALL.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_CONDITIONS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_CONDITIONS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_CONDITIONS — Automatically defined by this library when contracts are not checked for preconditions, postconditions, exceptions guarantees, and class invariants (excluding implementation checks). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_CONDITIONS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155869"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of contracts within specifications or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_FUNCTIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_ALL.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_CONSTRUCTORS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_DESTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_DESTRUCTORS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_OLDS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_DESTRUCTORS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_CONSTRUCTORS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_CONSTRUCTORS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_CONSTRUCTORS — Automatically defined by this library when contracts are not checked for constructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_CONSTRUCTORS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155475"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of contracts for constructors or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>Constructor preconditions are checked separately by <code class="computeroutput"><a class="link" href="boost/contract/constructor_precondition.html" title="Class template constructor_precondition">boost::contract::constructor_precondition</a></code> so they are disabled by <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code> instead.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.constructors" title="Constructors"> Constructors</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_OLDS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_DESTRUCTORS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_DESTRUCTORS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_CONSTRUCTORS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_DESTRUCTORS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_DESTRUCTORS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_DESTRUCTORS — Automatically defined by this library when contracts are not checked for destructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_DESTRUCTORS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155599"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of contracts for destructors or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.destructors" title="Destructors"> Destructors</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_ENTRY_INVARIANTS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_EXIT_INVARIANTS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_EXCEPTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_ENTRY_INVARIANTS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_ENTRY_INVARIANTS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_ENTRY_INVARIANTS — If defined, this library does not check class invariants at entry (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_ENTRY_INVARIANTS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155190"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking class invariants at entry. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of entry class invariants or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p>This macro is automatically defined when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> is defined.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_EXCEPTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_EXCEPTS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_ENTRY_INVARIANTS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_EXCEPTS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_EXCEPTS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_EXCEPTS — If defined, this library does not check exception guarantees (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_EXCEPTS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155091"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking exception guarantees. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of exception guarantees or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exception Guarantees</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_EXIT_INVARIANTS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_ENTRY_INVARIANTS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_EXIT_INVARIANTS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_EXIT_INVARIANTS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_EXIT_INVARIANTS — If defined, this library does not check class invariants at exit (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_EXIT_INVARIANTS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155243"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking class invariants at exit. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of exit class invariants or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p>This macro is automatically defined when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> is defined.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_INVARIANTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_FUNCTIONS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_CONDITIONS.html" title="Macro BOOST_CONTRACT_NO_CONDITIONS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_FUNCTIONS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_FUNCTIONS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_FUNCTIONS — Automatically defined by this library when contracts are not checked for non-member, private and protected functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_FUNCTIONS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155796"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of contracts for non-member, private and protected functions, or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p>This macro is also used when contracts are not checked for private and protected functions, lambda functions, code blocks, loops, etc.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.non_member_functions" title="Non-Member Functions"> Non-Member Functions</a>, <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.private_and_protected_functions" title="Private and Protected Functions">
|
||||
Private and Protected Functions</a>, <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.lambdas__loops__code_blocks__and__constexpr__" title="Lambdas, Loops, Code Blocks (and constexpr)">
|
||||
Lambdas, Loops, Code Blocks</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_INVARIANTS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_EXIT_INVARIANTS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_OLDS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_INVARIANTS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_INVARIANTS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_INVARIANTS — If defined, this library does not check class invariants (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_INVARIANTS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155328"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking class invariants. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of class invariants or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p>Defining this macro is equivalent to defining both <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_ENTRY_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_ENTRY_INVARIANTS">BOOST_CONTRACT_NO_ENTRY_INVARIANTS</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_EXIT_INVARIANTS">BOOST_CONTRACT_NO_EXIT_INVARIANTS</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_EXIT_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_OLDS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_OLDS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_CONSTRUCTORS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_OLDS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_OLDS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_OLDS — Automatically defined by this library when old value copies are not to be performed. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_OLDS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155419"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define both <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of old value copies or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.old_values" title="Old Values"> Old Values</a>, <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.old_copies_at_body" title="Old Copies at Body"> Old Values at Body</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_INVARIANTS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_CONSTRUCTORS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_POSTCONDITIONS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_PRECONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_EXCEPTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_POSTCONDITIONS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_POSTCONDITIONS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_POSTCONDITIONS — If defined, this library does not check postconditions (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_POSTCONDITIONS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155037"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking postconditions. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of postconditions or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.postconditions" title="Postconditions"> Postconditions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_PRECONDITIONS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_EXCEPTS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_PRECONDITIONS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_CHECKS.html" title="Macro BOOST_CONTRACT_NO_CHECKS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CHECKS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_PRECONDITIONS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_PRECONDITIONS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_PRECONDITIONS — If defined, this library does not check preconditions (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_PRECONDITIONS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154955"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library internal code is also optimized to reduce compile-time (not just run-time) overhead associated with checking preconditions. Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of preconditions or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.preconditions" title="Preconditions"> Preconditions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_checking" title="Disable Contract Checking">
|
||||
Disable Contract Checking</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_CHECKS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NO_DESTRUCTORS.html" title="Macro BOOST_CONTRACT_NO_DESTRUCTORS">
|
||||
<link rel="next" href="BOOST_CONTRACT_NO_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_FUNCTIONS">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_DESTRUCTORS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_FUNCTIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span></h2>
|
||||
<p>BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS — Automatically defined by this library when contracts are not checked for public functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1155657"></a><h2>Description</h2>
|
||||
<p>This library will define this macro when users define all <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_EXCEPTS.html" title="Macro BOOST_CONTRACT_NO_EXCEPTS">BOOST_CONTRACT_NO_EXCEPTS</a></code> (this macro is not a configuration macro and this library will generate a compile-time error if users try to define it directly). Users can manually program <code class="computeroutput">#ifndef</code> statements in their code using this macro to completely disable compilation of contracts for public functions or use the macros defined in <code class="computeroutput">boost/contract_macro.hpp</code> (recommended only for applications where it is truly necessary to completely remove contract code compilation from production code).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.public_functions" title="Public Functions"> Public Functions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NO_DESTRUCTORS.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NO_FUNCTIONS.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OLD</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_EXCEPT.html" title="Macro BOOST_CONTRACT_EXCEPT">
|
||||
<link rel="next" href="BOOST_CONTRACT_OLD_PTR.html" title="Macro BOOST_CONTRACT_OLD_PTR">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_EXCEPT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD_PTR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OLD"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OLD</span></h2>
|
||||
<p>BOOST_CONTRACT_OLD — Program old copies at body that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OLD(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1182094"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_OLD(f)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">BOOST_CONTRACT_NO_OLDS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="special">.</span><span class="identifier">old</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is the nullary functor called by this library <code class="computeroutput">f()</code> to assign old value copies just before the body is execute but after entry invariants (when they apply) and preconditions are checked. Old value pointers within this functor call are usually assigned using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_OLDOF.html" title="Macro BOOST_CONTRACT_OLDOF">BOOST_CONTRACT_OLDOF</a></code>. Any exception thrown by a call to this functor will result in this library calling <code class="computeroutput"><a class="link" href="boost/contract/old_failure.html" title="Function old_failure">boost::contract::old_failure</a></code> (because old values could not be copied to check postconditions and exception guarantees). This functor should capture old value pointers by references so they can be assigned (all other variables needed to evaluate old value expressions can be captured by (constant) value, or better by (constant) reference to avoid extra copies). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.old_copies_at_body" title="Old Copies at Body"> Old Copies at Body</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_EXCEPT.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD_PTR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OLDOF</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">
|
||||
<link rel="prev" href="boost/contract/copy_old_id547817.html" title="Function copy_old">
|
||||
<link rel="next" href="BOOST_CONTRACT_NAMED_OVERRIDE.html" title="Macro BOOST_CONTRACT_NAMED_OVERRIDE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/copy_old_id547817.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.old_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NAMED_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OLDOF"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OLDOF</span></h2>
|
||||
<p>BOOST_CONTRACT_OLDOF — Macro typically used to copy an old value expression and assign it to an old value pointer. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">boost/contract/old.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OLDOF(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177503"></a><h2>Description</h2>
|
||||
<p>The expression expanded by this macro should be assigned to an old value pointer of type <code class="computeroutput"><a class="link" href="boost/contract/old_ptr.html" title="Class template old_ptr">boost::contract::old_ptr</a></code> or <code class="computeroutput"><a class="link" href="boost/contract/old_ptr_if_copyable.html" title="Class template old_ptr_if_copyable">boost::contract::old_ptr_if_copyable</a></code>. This is an overloaded variadic macro and it can be used in the following different ways.</p>
|
||||
<p>1. From within virtual public functions and public functions overrides:</p>
|
||||
<pre class="programlisting"><span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">expr</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>2. From all other operations:</p>
|
||||
<pre class="programlisting"><span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">expr</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>v</strong></span></code> is the extra parameter of type <code class="computeroutput"><a class="link" href="boost/contract/virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual public function or public function overrides declaring the contract. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLDOF((v), expr)</code> will always work.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>expr</strong></span></code> is the expression to be evaluated and copied to the old value pointer. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLDOF(v, (expr))</code> will always work.)</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
On compilers that do not support variadic macros, programmers can manually copy old value expressions without using this macro (see <a class="link" href="boost_contract/extras.html#boost_contract.extras.no_macros__and_no_variadic_macros_" title="No Macros (and No Variadic Macros)"> No Macros</a>).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.old_values" title="Old Values"> Old Values</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/copy_old_id547817.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.old_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_NAMED_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OLD_PTR</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_OLD.html" title="Macro BOOST_CONTRACT_OLD">
|
||||
<link rel="next" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html" title="Macro BOOST_CONTRACT_OLD_PTR_IF_COPYABLE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OLD_PTR"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OLD_PTR</span></h2>
|
||||
<p>BOOST_CONTRACT_OLD_PTR — Program old values that can be completely disabled at compile-time (requires the old value type to be copyable). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OLD_PTR(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1182205"></a><h2>Description</h2>
|
||||
<p>This is an overloaded variadic macro and it can be used in the following different ways (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">BOOST_CONTRACT_NO_OLDS</a></code> is defined).</p>
|
||||
<p>1. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR(T)(ptr)</code> expands to code equivalent to the following (this leaves the old value pointer null):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="comment">// This never uses `v`.</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>2. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR(T)(ptr, expr)</code> expands to code equivalent to the following (this initializes the pointer to the old value copy, but not to be used for virtual public functions and public function overrides):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="special">=</span> <span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">expr</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>3. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR(T)(v, ptr, expr)</code> expands to code equivalent to the following (this initializes the pointer to the old value copy for virtual public functions and public function overrides): </p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="special">=</span> <span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">expr</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>T</strong></span></code> is the type of the pointed old value. This type must be copyable (i.e., <code class="computeroutput">boost::contract::is_old_value_copyable<T>::value</code> is <code class="computeroutput">true</code>), otherwise this pointer will always be null and this library will generate a compile-time error when the pointer is dereferenced (but see <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html" title="Macro BOOST_CONTRACT_OLD_PTR_IF_COPYABLE">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE</a></code>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>v</strong></span></code> is the extra parameter of type <code class="computeroutput"><a class="link" href="boost/contract/virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual public function or public function override declaring the contract. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLD_PTR(T)((v), ptr, expr)</code> will always work.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>ptr</strong></span></code> is the name of the old value pointer variable. (This is not a variadic macro parameter but it should never contain commas because it is an identifier.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>expr</strong></span></code> is the expression to be evaluated and copied in the old value pointer. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLD_PTR(T)(v, ptr, (expr))</code> will always work.)</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.old_values" title="Old Values"> Old Values</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OLD_PTR_IF_COPYABLE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_OLD_PTR.html" title="Macro BOOST_CONTRACT_OLD_PTR">
|
||||
<link rel="next" href="BOOST_CONTRACT_INVARIANT.html" title="Macro BOOST_CONTRACT_INVARIANT">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD_PTR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OLD_PTR_IF_COPYABLE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OLD_PTR_IF_COPYABLE</span></h2>
|
||||
<p>BOOST_CONTRACT_OLD_PTR_IF_COPYABLE — Program old values that can be completely disabled at compile-time (does not require the old value type to be copyable). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1182583"></a><h2>Description</h2>
|
||||
<p>This is an overloaded variadic macro and it can be used in the following different ways (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">BOOST_CONTRACT_NO_OLDS</a></code> is defined).</p>
|
||||
<p>1. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(T)(ptr)</code> expands to code equivalent to the following (this leaves the old value pointer null):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr_if_copyable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="comment">// This never uses `v`.</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>2. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(T)(ptr, expr)</code> expands to code equivalent to the following (this initializes the pointer to the old value copy, but not to be used for virtual public functions and public function overrides):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr_if_copyable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="special">=</span> <span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">expr</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>3. <code class="computeroutput">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(T)(v, ptr, expr)</code> expands to code equivalent to the following (this initializes the pointer to the old value copy for virtual public functions and public function overrides): </p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_OLDS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">old_ptr_if_copyable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">ptr</span> <span class="special">=</span>
|
||||
<span class="identifier">BOOST_CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">expr</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>T</strong></span></code> is the type of the pointed old value. If this type is not copyable (i.e., <code class="computeroutput">boost::contract::is_old_value_copyable<T>::value</code> is <code class="computeroutput">false</code>), this pointer will always be null, but this library will not generate a compile-time error when this pointer is dereferenced (but see <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_OLD_PTR.html" title="Macro BOOST_CONTRACT_OLD_PTR">BOOST_CONTRACT_OLD_PTR</a></code>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>v</strong></span></code> is the extra parameter of type <code class="computeroutput"><a class="link" href="boost/contract/virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual public function or public function override declaring the contract. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(T)((v), ptr, expr)</code> will always work.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>ptr</strong></span></code> is the name of the old value pointer variable. (This is not a variadic macro parameter but it should never contain commas because it is an identifier.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>expr</strong></span></code> is the expression to be evaluated and copied in the old value pointer. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, <code class="computeroutput">BOOST_CONTRACT_OLD_PTR_IF_COPYABLE(T)(v, ptr, (expr))</code> will always work.)</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/extras.html#boost_contract.extras.old_value_requirements__templates_" title="Old Value Requirements (Templates)">
|
||||
Old Value Requirements</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OLD_PTR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_INVARIANT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_PERMISSIVE.html" title="Macro BOOST_CONTRACT_PERMISSIVE">
|
||||
<link rel="next" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html" title="Macro BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PERMISSIVE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_ON_MISSING_CHECK_DECL"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL</span></h2>
|
||||
<p>BOOST_CONTRACT_ON_MISSING_CHECK_DECL — Code block to execute if contracts are not assigned to a <code class="computeroutput"><a class="link" href="boost/contract/check.html" title="Class check">boost::contract::check</a></code> variable (undefined by default and executes <code class="computeroutput">assert(false)</code>). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_ON_MISSING_CHECK_DECL</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154612"></a><h2>Description</h2>
|
||||
<p>In general, there is a logic error in the program when contracts are not assigned to a local variable of type <code class="computeroutput"><a class="link" href="boost/contract/check.html" title="Class check">boost::contract::check</a></code>. Therefore, by default (i.e., when this macro is not defined) this library calls <code class="computeroutput">assert(false)</code> in those cases. If this macro is defined, this library will execute the code expanded by the macro instead of calling <code class="computeroutput">assert(false)</code> (if programmers prefer to throw an exception, etc.).</p>
|
||||
<p>This macro can be defined to be any block of code (including <code class="computeroutput">{}</code> to generate no error), for example (on GCC): </p>
|
||||
<pre class="programlisting"><span class="special">-</span><span class="identifier">DBOOST_CONTRACT_ON_MISSING_CHECK_DECL</span><span class="special">=</span><span class="char">'{ throw std::logic_error("missing contract check declaration"); }'</span>
|
||||
</pre>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.non_member_functions" title="Non-Member Functions"> Non-Member Functions</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PERMISSIVE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+79
@@ -0,0 +1,79 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OVERRIDE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_NAMED_OVERRIDE.html" title="Macro BOOST_CONTRACT_NAMED_OVERRIDE">
|
||||
<link rel="next" href="BOOST_CONTRACT_OVERRIDES.html" title="Macro BOOST_CONTRACT_OVERRIDES">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NAMED_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OVERRIDES.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OVERRIDE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OVERRIDE</span></h2>
|
||||
<p>BOOST_CONTRACT_OVERRIDE — Declare an override type named <code class="computeroutput">override_<span class="emphasis"><em>function_name</em></span></code>. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">boost/contract/override.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OVERRIDE(function_name)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177809"></a><h2>Description</h2>
|
||||
<p>Declare the override type to pass as an explicit template parameter to <code class="computeroutput"><a class="link" href="boost/contract/public_function_id548174.html" title="Function template public_function">boost::contract::public_function</a></code> for public function overrides.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.public_function_overrides__subcontracting_" title="Public Function Overrides (Subcontracting)">
|
||||
Public Function Overrides</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">function_name</code></span></p></td>
|
||||
<td><p>Function name of the public function override. This macro is called just once even if the function name is overloaded (the same override type is used for all overloaded functions with the same name, see <a class="link" href="boost_contract/advanced.html#boost_contract.advanced.function_overloads" title="Function Overloads">
|
||||
Function Overloads</a>). (This is not a variadic macro parameter but it should never contain any comma because it is an identifier.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_NAMED_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_OVERRIDES.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_OVERRIDES</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_OVERRIDE.html" title="Macro BOOST_CONTRACT_OVERRIDE">
|
||||
<link rel="next" href="boost/contract/public_function_id548174.html" title="Function template public_function">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/public_function_id548174.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_OVERRIDES"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_OVERRIDES</span></h2>
|
||||
<p>BOOST_CONTRACT_OVERRIDES — Declare multiple override types at once naming them <code class="computeroutput">override_...</code> (for convenience). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.override_hpp" title="Header <boost/contract/override.hpp>">boost/contract/override.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_OVERRIDES(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177877"></a><h2>Description</h2>
|
||||
<p>This variadic macro is provided for convenience only, <code class="computeroutput">BOOST_CONTRACT_OVERRIDES(f1, f2, ..., fn)</code> expands to code equivalent to:</p>
|
||||
<pre class="programlisting"><span class="identifier">BOOST_CONTRACT_OVERRIDE</span><span class="special">(</span><span class="identifier">f1</span><span class="special">)</span>
|
||||
<span class="identifier">BOOST_CONTRACT_OVERRIDE</span><span class="special">(</span><span class="identifier">f2</span><span class="special">)</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">BOOST_CONTRACT_OVERRIDE</span><span class="special">(</span><span class="identifier">fn</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>On compilers that do not support variadic macros, the override types can be equivalently programmed one-by-one calling <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_OVERRIDE.html" title="Macro BOOST_CONTRACT_OVERRIDE">BOOST_CONTRACT_OVERRIDE</a></code> for each function name as shown above.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.public_function_overrides__subcontracting_" title="Public Function Overrides (Subcontracting)">
|
||||
Public Function Overrides</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">...</code></span></p></td>
|
||||
<td><p>A comma separated list of one or more function names of public function overrides. (Each function name should never contain commas because it is an identifier.) </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.override_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost/contract/public_function_id548174.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_PERMISSIVE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html" title="Macro BOOST_CONTRACT_STATIC_INVARIANT_FUNC">
|
||||
<link rel="next" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html" title="Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_PERMISSIVE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_PERMISSIVE</span></h2>
|
||||
<p>BOOST_CONTRACT_PERMISSIVE — Disable some compile-time errors generated by this library (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_PERMISSIVE</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154481"></a><h2>Description</h2>
|
||||
<p>Defining this macro disables a number of static checks and related compile-time errors, for example:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>The static invariant member <code class="computeroutput">BOOST_CONTRACT_STATIC_INVARIANT_FUNC</code> function must be declared <code class="computeroutput">static</code>. </p></li>
|
||||
<li class="listitem"><p>Non-static invariant member functions <code class="computeroutput">BOOST_CONTRACT_INVARIANT_FUNC</code> must be declared either <code class="computeroutput">const</code>, <code class="computeroutput">const volatile</code>, or <code class="computeroutput">volatile const</code>. </p></li>
|
||||
<li class="listitem"><p>Derived classes that program contracts for one or more public function overrides via <code class="computeroutput"><a class="link" href="boost/contract/public_function_id548174.html" title="Function template public_function">boost::contract::public_function</a></code> must also define the <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_BASE_TYPES.html" title="Macro BOOST_CONTRACT_BASE_TYPES">BOOST_CONTRACT_BASE_TYPES</a></code> <code class="computeroutput">typedef</code>.</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
In general, it is not recommended to define this macro because these compile-time checks can guard against missuses of this library.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.base_classes__subcontracting_" title="Base Classes (Subcontracting)"> Base Classes</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_STATIC_INVARIANT_FUNC.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_POSTCONDITION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_PRECONDITION.html" title="Macro BOOST_CONTRACT_PRECONDITION">
|
||||
<link rel="next" href="BOOST_CONTRACT_EXCEPT.html" title="Macro BOOST_CONTRACT_EXCEPT">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PRECONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_EXCEPT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_POSTCONDITION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_POSTCONDITION</span></h2>
|
||||
<p>BOOST_CONTRACT_POSTCONDITION — Program postconditions that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_POSTCONDITION(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1181806"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_POSTCONDITION(f)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_POSTCONDITIONS.html" title="Macro BOOST_CONTRACT_NO_POSTCONDITIONS">BOOST_CONTRACT_NO_POSTCONDITIONS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_POSTCONDITIONS</span>
|
||||
<span class="special">.</span><span class="identifier">postcondition</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is the functor called by this library to check postconditions <code class="computeroutput">f(...)</code>. Assertions within this functor are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling <code class="computeroutput"><a class="link" href="boost/contract/postcondition_failure.html" title="Function postcondition_failure">boost::contract::postcondition_failure</a></code>). This functor should capture variables by (constant) references (to access the values they will have at function exit). This functor takes the return value as its one single parameter but only for virtual public functions and public functions overrides, otherwise it takes no parameter. (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.postconditions" title="Postconditions"> Postconditions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PRECONDITION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_EXCEPT.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_PRECONDITION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="boost/contract/public_function_id553108.html" title="Function template public_function">
|
||||
<link rel="next" href="BOOST_CONTRACT_POSTCONDITION.html" title="Macro BOOST_CONTRACT_POSTCONDITION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/public_function_id553108.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_POSTCONDITION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_PRECONDITION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_PRECONDITION</span></h2>
|
||||
<p>BOOST_CONTRACT_PRECONDITION — Program preconditions that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_PRECONDITION(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1181662"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_PRECONDITION(f)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PRECONDITIONS.html" title="Macro BOOST_CONTRACT_NO_PRECONDITIONS">BOOST_CONTRACT_NO_PRECONDITIONS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PRECONDITIONS</span>
|
||||
<span class="special">.</span><span class="identifier">precondition</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is the nullay functor called by this library to check preconditions <code class="computeroutput">f()</code>. Assertions within this functor are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling <code class="computeroutput"><a class="link" href="boost/contract/precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code>). This functor should capture variables by (constant) value, or better by (constant) reference (to avoid extra copies). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.preconditions" title="Preconditions"> Preconditions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost/contract/public_function_id553108.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_POSTCONDITION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html" title="Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL">
|
||||
<link rel="next" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html" title="Macro BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION</span></h2>
|
||||
<p>BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION — Define this macro to not disable other assertions while checking preconditions (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154713"></a><h2>Description</h2>
|
||||
<p>Not disabling other assertions while checking preconditions can lead to infinite recursion in user code so by default this macro is not defined.</p>
|
||||
<p>However, the <a class="link" href="boost_contract/bibliography.html" title="Bibliography"> [1962]</a> proposal does not disable any assertion while checking preconditions because arguments can reach the function body unchecked if assertions are disabled while checking preconditions (e.g., when these same functions bodies are called to check the preconditions in question). This macro can be defined to obtain the behaviour specified in <a class="link" href="boost_contract/bibliography.html" title="Bibliography"> [1962]</a> (at the risk of infinite recursion).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/contract_programming_overview.html#boost_contract.contract_programming_overview.feature_summary" title="Feature Summary">
|
||||
Feature Summary</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_PUBLIC_FUNCTION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_DESTRUCTOR.html" title="Macro BOOST_CONTRACT_DESTRUCTOR">
|
||||
<link rel="next" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html" title="Macro BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_DESTRUCTOR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_PUBLIC_FUNCTION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_PUBLIC_FUNCTION</span></h2>
|
||||
<p>BOOST_CONTRACT_PUBLIC_FUNCTION — Program contracts that can be completely disabled at compile-time for non-static public functions (virtual or not) that do not override. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_PUBLIC_FUNCTION(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186963"></a><h2>Description</h2>
|
||||
<p>This is an overloaded variadic macro and it can be used in the following different ways (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</a></code> is defined).</p>
|
||||
<p>1. <code class="computeroutput">BOOST_CONTRACT_PUBLIC_FUNCTION(obj)</code> expands to code equivalent to the following (for non-virtual public functions that are not static and do not override, returning void or not):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special">(</span><span class="identifier">obj</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>2. <code class="computeroutput">BOOST_CONTRACT_PUBLIC_FUNCTION(v, obj)</code> expands to code equivalent to the following (for virtual public functions that are not static and do not override, returning void):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">obj</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>3. <code class="computeroutput">BOOST_CONTRACT_PUBLIC_FUNCTION(v, r, obj)</code> expands to code equivalent to the following (for virtual public functions that are not static and do not override, not returning void):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">obj</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where (these are all variadic macro parameters so they can contain commas not protected by round parenthesis):</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>v</strong></span></code> is the extra parameter of type <code class="computeroutput"><a class="link" href="boost/contract/virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual public function declaring the contract. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>r</strong></span></code> is a reference to the return value of the enclosing virtual public function declaring the contract. This is usually a local variable declared by the enclosing virtual public function just before the contract, but programmers must set it to the actual value being returned by the function at each <code class="computeroutput">return</code> statement. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>obj</strong></span></code> is the object <code class="computeroutput">this</code> from the scope of the enclosing public function declaring the contract. This object might be mutable, <code class="computeroutput">const</code>, <code class="computeroutput">volatile</code>, or <code class="computeroutput">const volatile</code> depending on the cv-qualifier of the enclosing function (volatile public functions will check volatile class invariants, see <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>). </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.public_functions" title="Public Functions"> Public Functions</a>, <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.virtual_public_functions" title="Virtual Public Functions">
|
||||
Virtual Public Functions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_DESTRUCTOR.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html" title="Macro BOOST_CONTRACT_PUBLIC_FUNCTION">
|
||||
<link rel="next" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html" title="Macro BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE</span></h2>
|
||||
<p>BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE — Program contracts that can be completely disabled at compile-time for public function overrides (virtual or not). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1185150"></a><h2>Description</h2>
|
||||
<p>This is an overloaded variadic macro and it can be used in the following different ways (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</a></code> is defined).</p>
|
||||
<p>1. <code class="computeroutput">BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE(Override)(v, f, obj, ...)</code> expands to code equivalent to the following (for public function overrides that return void):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special"><</span><span class="identifier">Override</span><span class="special">></span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">obj</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>2. <code class="computeroutput">BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE(Override)(v, r, f, obj, ...) </code> expands to code equivalent to the following (for public function overrides that do not return void):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special"><</span><span class="identifier">Override</span><span class="special">></span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">obj</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where (these are all variadic macro parameters so they can contain commas not protected by round parenthesis):</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>Override</strong></span></code> is the type <code class="computeroutput">override_<span class="emphasis"><em>function-name</em></span></code> declared using the <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_OVERRIDE.html" title="Macro BOOST_CONTRACT_OVERRIDE">BOOST_CONTRACT_OVERRIDE</a></code> or related macros. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>v</strong></span></code> is the extra parameter of type <code class="computeroutput"><a class="link" href="boost/contract/virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual public function declaring the contract. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>r</strong></span></code> is a reference to the return value of the enclosing virtual public function declaring the contract. This is usually a local variable declared by the enclosing virtual public function just before the contract, but programmers must set it to the actual value being returned by the function at each <code class="computeroutput">return</code> statement. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>f</strong></span></code> is a pointer to the enclosing public function override declaring the contract. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>obj</strong></span></code> is the object <code class="computeroutput">this</code> from the scope of the enclosing public function declaring the contract. This object might be mutable, <code class="computeroutput">const</code>, <code class="computeroutput">volatile</code>, or <code class="computeroutput">const volatile</code> depending on the cv-qualifier of the enclosing function (volatile public functions will check volatile class invariants, see <a class="link" href="boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>). </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>...</strong></span></code> is a variadic macro parameter listing all the arguments passed to the enclosing public function override declaring the contract (by reference and in order they appear in the enclosing function declaration), but excluding the trailing argument <code class="computeroutput">v</code>. </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.public_function_overrides__subcontracting_" title="Public Function Overrides (Subcontracting)">
|
||||
Public Function Overrides</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_STATIC_INVARIANT</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html" title="Macro BOOST_CONTRACT_INVARIANT_VOLATILE">
|
||||
<link rel="next" href="BOOST_CONTRACT_CONSTRUCTOR.html" title="Macro BOOST_CONTRACT_CONSTRUCTOR">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CONSTRUCTOR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_STATIC_INVARIANT"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_STATIC_INVARIANT</span></h2>
|
||||
<p>BOOST_CONTRACT_STATIC_INVARIANT — Program static class invariants that can be completely disabled at compile-time. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_STATIC_INVARIANT(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1186129"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_STATIC_INVARIANT</code>({ ... }) expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_INVARIANTS.html" title="Macro BOOST_CONTRACT_NO_INVARIANTS">BOOST_CONTRACT_NO_INVARIANTS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_INVARIANTS</span>
|
||||
<span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">BOOST_CONTRACT_STATIC_INVARIANT_FUNC</span><span class="special">(</span><span class="special">)</span> <span class="special">{</span>
|
||||
<span class="special">...</span>
|
||||
<span class="special">}</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="bold"><strong>{ ... }</strong></span> is the definition of the function that checks class invariants for static public functions (see <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_INVARIANT.html" title="Macro BOOST_CONTRACT_INVARIANT">BOOST_CONTRACT_INVARIANT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html" title="Macro BOOST_CONTRACT_INVARIANT_VOLATILE">BOOST_CONTRACT_INVARIANT_VOLATILE</a></code>). Assertions within this function are usually programmed using <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code>, but any exception thrown by a call to this function indicates a contract assertion failure (and will result in this library calling either <code class="computeroutput"><a class="link" href="boost/contract/entry_invariant_failure.html" title="Function entry_invariant_failure">boost::contract::entry_invariant_failure</a></code> or <code class="computeroutput"><a class="link" href="boost/contract/exit_invariant_failure.html" title="Function exit_invariant_failure">boost::contract::exit_invariant_failure</a></code>). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)</p></li></ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT_VOLATILE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_CONSTRUCTOR.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_STATIC_INVARIANT_FUNC</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_INVARIANT_FUNC.html" title="Macro BOOST_CONTRACT_INVARIANT_FUNC">
|
||||
<link rel="next" href="BOOST_CONTRACT_PERMISSIVE.html" title="Macro BOOST_CONTRACT_PERMISSIVE">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT_FUNC.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PERMISSIVE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_STATIC_INVARIANT_FUNC"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_STATIC_INVARIANT_FUNC</span></h2>
|
||||
<p>BOOST_CONTRACT_STATIC_INVARIANT_FUNC — Define the name of the static invariant member function (<code class="computeroutput">static_invariant</code> by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_STATIC_INVARIANT_FUNC</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154395"></a><h2>Description</h2>
|
||||
<p>This macro expands to the name of the <code class="computeroutput">static</code> member function that checks static class invariants. This macro can be defined if this static invariant function must have a name different from <code class="computeroutput">static_invariant</code> (because of name clashes in suer code, etc.).</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>C++ does not allow to overload member functions based on the <code class="computeroutput">static</code> classifier, so this macro must always be defined to be different than the function name defined for <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_INVARIANT_FUNC.html" title="Macro BOOST_CONTRACT_INVARIANT_FUNC">BOOST_CONTRACT_INVARIANT_FUNC</a></code>.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_INVARIANT_FUNC.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_PERMISSIVE.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_STATIC_LINK</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_CHECK_AXIOM.html" title="Macro BOOST_CONTRACT_CHECK_AXIOM">
|
||||
<link rel="next" href="BOOST_CONTRACT_HEADER_ONLY.html" title="Macro BOOST_CONTRACT_HEADER_ONLY">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK_AXIOM.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_HEADER_ONLY.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_STATIC_LINK"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_STATIC_LINK</span></h2>
|
||||
<p>BOOST_CONTRACT_STATIC_LINK — Define this macro to compile this library as a static (instead of shared) library (undefined by default). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract.core.config_hpp" title="Header <boost/contract/core/config.hpp>">boost/contract/core/config.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_STATIC_LINK</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1151621"></a><h2>Description</h2>
|
||||
<p>If this macro is defined, this library is compiled so it can be linked statically to user code (and not as a shared library as by default).</p>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>This library is not guaranteed to always work correctly at run-time when this macro is defined. However, this macro can be defined and this library can be safely used as a static library for user code that checks contracts in a single program unit (e.g., a single program with only statically linked libraries that check contracts).</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/getting_started.html#boost_contract.getting_started.install_and_compile" title="Install and Compile"> Install and Compile</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_CHECK_AXIOM.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract.core.config_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_HEADER_ONLY.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Macro BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION</title>
|
||||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">
|
||||
<link rel="prev" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html" title="Macro BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE">
|
||||
<link rel="next" href="BOOST_CONTRACT_FUNCTION.html" title="Macro BOOST_CONTRACT_FUNCTION">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../..//boost.png"></td>
|
||||
<td align="center"><a href="../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Macro BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION</span></h2>
|
||||
<p>BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION — Program contracts that can be completely disabled at compile-time for static public functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="reference.html#header.boost.contract_macro_hpp" title="Header <boost/contract_macro.hpp>">boost/contract_macro.hpp</a>>
|
||||
|
||||
</span>BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION(...)</pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1185590"></a><h2>Description</h2>
|
||||
<p><code class="computeroutput">BOOST_CONTRACT_STATIC_PUBLIC_FUNCTION(Class)</code> expands to code equivalent to the following (note that no code is generated when <code class="computeroutput"><a class="link" href="BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS.html" title="Macro BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</a></code> is defined):</p>
|
||||
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">check</span> <span class="identifier">internal_var</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span>
|
||||
<span class="identifier">public_function</span><span class="special"><</span><span class="identifier">Class</span><span class="special">></span><span class="special">(</span><span class="special">)</span>
|
||||
<span class="preprocessor">#endif</span>
|
||||
</pre>
|
||||
<p>Where:</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>Class</strong></span></code> is the type of the class containing the static public function declaring the contract. (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.) </p></li>
|
||||
<li class="listitem"><p><code class="computeroutput"><span class="bold"><strong>internal_var</strong></span></code> is a variable name internally generated by this library (this name is unique but only on different line numbers so this macro cannot be expanded multiple times on the same line).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="boost_contract/tutorial.html#boost_contract.tutorial.static_public_functions" title="Static Public Functions"> Static Public Functions</a>, <a class="link" href="boost_contract/extras.html#boost_contract.extras.disable_contract_compilation__macro_interface_" title="Disable Contract Compilation (Macro Interface)">
|
||||
Disable Contract Compilation</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BOOST_CONTRACT_PUBLIC_FUNCTION_OVERRIDE.html"><img src="../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.contract_macro_hpp"><img src="../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_CONTRACT_FUNCTION.html"><img src="../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class access</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.access_hpp" title="Header <boost/contract/core/access.hpp>">
|
||||
<link rel="prev" href="constructor.html" title="Function template constructor">
|
||||
<link rel="next" href="../../BOOST_CONTRACT_CHECK.html" title="Macro BOOST_CONTRACT_CHECK">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="constructor.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.access_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../BOOST_CONTRACT_CHECK.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.access"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class access</span></h2>
|
||||
<p>boost::contract::access — Friend this class to declare invariants and base types as private members. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.access_hpp" title="Header <boost/contract/core/access.hpp>">boost/contract/core/access.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">class</span> <a class="link" href="access.html" title="Class access">access</a> <span class="special">{</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1153109"></a><h2>Description</h2>
|
||||
<p>Declare this class a friend of the user-defined class specifying the contracts in order to declare the invariant functions and the base types <code class="computeroutput">typedef</code> as non-public members. In real code, programmers will likely chose to declare this class as friend so to fully control public interfaces of their user-defined classes.</p>
|
||||
<p>This class is not intended to be directly used by programmers a part from declaring it <code class="computeroutput">friend</code> (and that is why this class does not have any public member and it is not copyable).</p>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>Not declaring this class friend of user-defined classes will cause compiler errors on some compilers (e.g., MSVC) because the private members needed to check the contracts will not be accessible. On other compilers (e.g., GCC and CLang), the private access will instead fail SFINAE and no compiler error will be reported while invariants and subcontracting will be silently skipped at run-time. Therefore, programmers must make sure to either declare this class as friend (preferred) or to always declare invariant functions and base types <code class="computeroutput">typedef</code> as public members.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.access_specifiers" title="Access Specifiers"> Access Specifiers</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="constructor.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.access_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../BOOST_CONTRACT_CHECK.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class assertion_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="constructor_precondition.html" title="Class template constructor_precondition">
|
||||
<link rel="next" href="bad_virtual_result_cast.html" title="Class bad_virtual_result_cast">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="constructor_precondition.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bad_virtual_result_cast.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.assertion_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class assertion_failure</span></h2>
|
||||
<p>boost::contract::assertion_failure — Exception typically used to report a contract assertion failure. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">class</span> <a class="link" href="assertion_failure.html" title="Class assertion_failure">assertion_failure</a> <span class="special">:</span>
|
||||
<span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span>, <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">exception</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="comment">// <a class="link" href="assertion_failure.html#boost.contract.assertion_failureconstruct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="assertion_failure.html#id545494-bb"><span class="identifier">assertion_failure</span></a><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <span class="special">=</span> <span class="string">""</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">long</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <span class="special">=</span> <span class="string">""</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="assertion_failure.html#id545533-bb"><span class="identifier">assertion_failure</span></a><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="assertion_failure.html#id545576-bb"><span class="special">~</span><span class="identifier">assertion_failure</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// <a class="link" href="assertion_failure.html#id545392-bb">public member functions</a></span>
|
||||
<span class="keyword">virtual</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a class="link" href="assertion_failure.html#id545368-bb"><span class="identifier">what</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a class="link" href="assertion_failure.html#id545419-bb"><span class="identifier">file</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">unsigned</span> <span class="keyword">long</span> <a class="link" href="assertion_failure.html#id545460-bb"><span class="identifier">line</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a class="link" href="assertion_failure.html#id545448-bb"><span class="identifier">code</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1157122"></a><h2>Description</h2>
|
||||
<p>This exception is thrown by code expanded by <code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code> (but it can also be thrown by user code programmed manually without that macro). This exception is typically used to report contract assertion failures because it contains detailed information about the file name, line number, and source code of the asserted condition (so it can be used by this library to provide detailed error messages). However, any other exception can be used to report a contract assertion failure (including user-defined exceptions).</p>
|
||||
<p>This library will call the appropriate contract failure handler function ( <code class="computeroutput"><a class="link" href="precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code>, etc.) when this or any other exception is thrown while checking contracts (by default, these failure handler functions print an error message to <code class="computeroutput">std::cerr</code> and terminate the program, but they can be customized to take any other action).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.no_macros__and_no_variadic_macros_" title="No Macros (and No Variadic Macros)"> No Macros</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1157158"></a><h3>
|
||||
<a name="boost.contract.assertion_failureconstruct-copy-destruct"></a><code class="computeroutput">assertion_failure</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id545494-bb"></a><span class="identifier">assertion_failure</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> file <span class="special">=</span> <span class="string">""</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">long</span> line <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
|
||||
<span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> code <span class="special">=</span> <span class="string">""</span><span class="special">)</span><span class="special">;</span></pre>Construct this object with file name, line number, and source code text of an assertion condition (all optional). <p>This constructor can also be used to specify no information (default constructor), or to specify only file name and line number but not source code text (because of the parameter default values).</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">code</code></span></p></td>
|
||||
<td><p>Text listing the source code of the assertion condition. </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">file</code></span></p></td>
|
||||
<td><p>Name of the file containing the assertion (usually set using <code class="computeroutput">__FILE__</code>). </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">line</code></span></p></td>
|
||||
<td><p>Number of the line containing the assertion (usually set using <code class="computeroutput">__LINE__</code>). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id545533-bb"></a><span class="identifier">assertion_failure</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> code<span class="special">)</span><span class="special">;</span></pre>Construct this object only with the source code text of the assertion condition. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">code</code></span></p></td>
|
||||
<td><p>Text listing the source code of the assertion condition. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id545576-bb"></a><span class="special">~</span><span class="identifier">assertion_failure</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11). </p>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1157442"></a><h3>
|
||||
<a name="id545392-bb"></a><code class="computeroutput">assertion_failure</code> public member functions</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">virtual</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a name="id545368-bb"></a><span class="identifier">what</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>String describing the failed assertion. <p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11).
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A string formatted similarly to the following: <code class="computeroutput">assertion "`code()`" failed: file "`file()`", line `line()`</code>. File, line, and code will be omitted from this string if they were not specified when constructing this object. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a name="id545419-bb"></a><span class="identifier">file</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Name of the file containing the assertion. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>File name as specified at construction (or <code class="computeroutput">""</code> if no file was specified). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">unsigned</span> <span class="keyword">long</span> <a name="id545460-bb"></a><span class="identifier">line</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Number of the line containing the assertion. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>Line number as specified at construction (or <code class="computeroutput">0</code> if no line number was specified). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a name="id545448-bb"></a><span class="identifier">code</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Text listing the source code of the assertion condition. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>Assertion condition source code as specified at construction (or <code class="computeroutput">""</code> if no source code text was specified). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="constructor_precondition.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bad_virtual_result_cast.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class bad_virtual_result_cast</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="assertion_failure.html" title="Class assertion_failure">
|
||||
<link rel="next" href="exception.html" title="Class exception">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="assertion_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="exception.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.bad_virtual_result_cast"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class bad_virtual_result_cast</span></h2>
|
||||
<p>boost::contract::bad_virtual_result_cast — Exception thrown when inconsistent return values are passed to overridden virtual public functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">class</span> <a class="link" href="bad_virtual_result_cast.html" title="Class bad_virtual_result_cast">bad_virtual_result_cast</a> <span class="special">:</span>
|
||||
<span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_cast</span>, <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">exception</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="comment">// <a class="link" href="bad_virtual_result_cast.html#boost.contract.bad_virtual_result_castconstruct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="bad_virtual_result_cast.html#id545644-bb"><span class="identifier">bad_virtual_result_cast</span></a><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">,</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="bad_virtual_result_cast.html#id545652-bb"><span class="special">~</span><span class="identifier">bad_virtual_result_cast</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// <a class="link" href="bad_virtual_result_cast.html#id545617-bb">public member functions</a></span>
|
||||
<span class="keyword">virtual</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a class="link" href="bad_virtual_result_cast.html#id545597-bb"><span class="identifier">what</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1162924"></a><h2>Description</h2>
|
||||
<p>This exception is internally thrown by this library when programmers specify return values for public function overrides in derived classes that are not consistent with the return types of the virtual public functions being overridden in the base classes. This allows this library to give more descriptive error messages in such cases.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.public_function_overrides__subcontracting_" title="Public Function Overrides (Subcontracting)">
|
||||
Public Function Overrides</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1162937"></a><h3>
|
||||
<a name="boost.contract.bad_virtual_result_castconstruct-copy-destruct"></a><code class="computeroutput">bad_virtual_result_cast</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id545644-bb"></a><span class="identifier">bad_virtual_result_cast</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> from_type_name<span class="special">,</span>
|
||||
<span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> to_type_name<span class="special">)</span><span class="special">;</span></pre>Construct this object with the name of the from- and to- result types. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">from_type_name</code></span></p></td>
|
||||
<td><p>Name of the from-type (source of the cast). </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">to_type_name</code></span></p></td>
|
||||
<td><p>Name of the to-type (destination of the cast). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id545652-bb"></a><span class="special">~</span><span class="identifier">bad_virtual_result_cast</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11). </p>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1163071"></a><h3>
|
||||
<a name="id545617-bb"></a><code class="computeroutput">bad_virtual_result_cast</code> public member functions</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">virtual</span> <span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span> <a name="id545597-bb"></a><span class="identifier">what</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Description for this error (containing both from- and to- type names). <p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11). </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="assertion_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="exception.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template call_if</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_c.html" title="Function template call_if_c">
|
||||
<link rel="next" href="condition_if_c.html" title="Function template condition_if_c">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_c.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="condition_if_c.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template call_if</span></h2>
|
||||
<p>boost::contract::call_if — Select compilation and execution of functor template calls using a nullary boolean meta-function. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">Pred</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">Then</span> <span class="special">></span> <span class="identifier">call_if</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1147757"></a><h2>Description</h2>
|
||||
<p>Create a call-if object with the specified then-branch functor template. This is equivalent to <code class="computeroutput">boost::contract::call_if_c<Pred::value>(f)</code>. Optional functor templates for else-if-branches and the else-branch can be specified as needed. For example:</p>
|
||||
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">call_if</span><span class="special"><</span><span class="identifier">MetaFunction1</span><span class="special">></span><span class="special">(</span>
|
||||
<span class="identifier">then_functor_template1</span>
|
||||
<span class="special">)</span><span class="special">.</span><span class="keyword">template</span> <span class="identifier">else_if</span><span class="special"><</span><span class="identifier">MetaFunction2</span><span class="special">></span><span class="special">(</span> <span class="comment">// Optional.</span>
|
||||
<span class="identifier">then_functor_template2</span>
|
||||
<span class="special">)</span>
|
||||
<span class="special">...</span> <span class="comment">// Optionally, other `else_if`.</span>
|
||||
<span class="special">.</span><span class="identifier">else_</span><span class="special">(</span> <span class="comment">// Optional for `void` functors,</span>
|
||||
<span class="identifier">else_functor_template</span> <span class="comment">// but required for non `void`.</span>
|
||||
<span class="special">)</span>
|
||||
</pre>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is compiled and executed if and only if <code class="computeroutput">Pred::value</code> is <code class="computeroutput">true</code>. The return type of other functor template calls specified for this call-if statement (else-branches, else-if-branches, etc.) must be the same as (or implicitly convertible to) the return type of then-branch functor template call <code class="computeroutput">f()</code>.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Pred</code></span></p></td>
|
||||
<td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so else and else-if statements can be specified if needed. Eventually, this will be the return value of the functor template call being compiled and executed (which can also be <code class="computeroutput">void</code>). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_c.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="condition_if_c.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template call_if_c</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_statement_id541344.html" title="Struct template call_if_statement<true, Then, void>">
|
||||
<link rel="next" href="call_if.html" title="Function template call_if">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id541344.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_c"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template call_if_c</span></h2>
|
||||
<p>boost::contract::call_if_c — Select compilation and execution of functor template calls using a static boolean predicate. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">Pred</span><span class="special">,</span> <span class="identifier">Then</span> <span class="special">></span> <span class="identifier">call_if_c</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1149705"></a><h2>Description</h2>
|
||||
<p>Create a call-if object with the specified then-branch functor template. Optional functor templates for else-if-branches and the else-branch can be specified as needed. For example:</p>
|
||||
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">call_if</span><span class="special"><</span><span class="identifier">Predicate1</span><span class="special">></span><span class="special">(</span>
|
||||
<span class="identifier">then_functor_template1</span>
|
||||
<span class="special">)</span><span class="special">.</span><span class="keyword">template</span> <span class="identifier">else_if</span><span class="special"><</span><span class="identifier">Predicate2</span><span class="special">></span><span class="special">(</span> <span class="comment">// Optional.</span>
|
||||
<span class="identifier">then_functor_template2</span>
|
||||
<span class="special">)</span>
|
||||
<span class="special">...</span> <span class="comment">// Optionally, other `else_if`.</span>
|
||||
<span class="special">.</span><span class="identifier">else_</span><span class="special">(</span> <span class="comment">// Optional for `void` functors,</span>
|
||||
<span class="identifier">else_functor_template</span> <span class="comment">// but required for non `void`.</span>
|
||||
<span class="special">)</span>
|
||||
</pre>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is compiled and executed if and only if <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>. The return type of other functor template calls specified for this call-if statement (else-branches, else-if-branches, etc.) must be the same as (or implicitly convertible to) the return type of then-branch functor call <code class="computeroutput">f()</code>.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Pred</code></span></p></td>
|
||||
<td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so else and else-if statements can be specified if needed. Eventually, this will be the return value of the functor template call being compiled and executed (which can also be <code class="computeroutput">void</code>). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id541344.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Struct template call_if_statement</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="../../BOOST_CONTRACT_BASE_TYPES.html" title="Macro BOOST_CONTRACT_BASE_TYPES">
|
||||
<link rel="next" href="call_if_statement_id540655.html" title="Struct template call_if_statement<false, Then, internal_type>">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../../BOOST_CONTRACT_BASE_TYPES.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id540655.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_statement"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Struct template call_if_statement</span></h2>
|
||||
<p>boost::contract::call_if_statement — Select compilation and execution of functor template calls using a static boolean predicate. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Then<span class="special">,</span> <span class="keyword">typename</span> ThenResult <span class="special">=</span> <span class="identifier">internal_type</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a> <span class="special">{</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1141304"></a><h2>Description</h2>
|
||||
<p>This class template has no member because it is never used directly, it is only used via its specializations. Usually this class template is instantiated only via the return value of <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1141348"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">bool</span> Pred</pre>
|
||||
<p>Static boolean predicate that selects which functor template call to compile and execute. </p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
|
||||
<p>Type of the functor template to call if the static predicate is <code class="computeroutput">true</code>. </p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> ThenResult <span class="special">=</span> <span class="identifier">internal_type</span></pre>
|
||||
<p>Return type of then-branch functor template call (this is usually automatically deduced by this library so it is never explicitly specified by the user, and that is why it is often marked as <code class="computeroutput">internal_type</code> in this documentation). </p>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../../BOOST_CONTRACT_BASE_TYPES.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id540655.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Struct template call_if_statement<false, Then, internal_type></title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_statement.html" title="Struct template call_if_statement">
|
||||
<link rel="next" href="call_if_statement_id540910.html" title="Struct template call_if_statement<true, Then, internal_type>">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id540910.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_statement_id540655"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Struct template call_if_statement<false, Then, internal_type></span></h2>
|
||||
<p>boost::contract::call_if_statement<false, Then, internal_type> — Handle static predicates that are <code class="computeroutput">false</code>. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="call_if_statement_id540655.html" title="Struct template call_if_statement<false, Then, internal_type>">call_if_statement</a><span class="special"><</span><span class="keyword">false</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">internal_type</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id540655.html#boost.contract.call_if_statement_id540655construct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="call_if_statement_id540655.html#id540935-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id540655.html#id540750-bb">public member functions</a></span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">result_of</span><span class="special"><</span> <span class="identifier">Else</span><span class="special">(</span><span class="special">)</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="call_if_statement_id540655.html#id540716-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">ElseIfPred</span><span class="special">,</span> <span class="identifier">ElseIfThen</span> <span class="special">></span> <a class="link" href="call_if_statement_id540655.html#id540766-bb"><span class="identifier">else_if_c</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">ElseIfPred</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">ElseIfThen</span> <span class="special">></span>
|
||||
<a class="link" href="call_if_statement_id540655.html#id540856-bb"><span class="identifier">else_if</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1139549"></a><h2>Description</h2>
|
||||
<p>This single specialization handles all else-branch functor template calls (whether they return void or not). Usually this class template is instantiated only via the return value of <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1139566"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
|
||||
<p>Type of functor template to call when the static predicate is <code class="computeroutput">true</code> (never the case for this template specialization). </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1139625"></a><h3>
|
||||
<a name="boost.contract.call_if_statement_id540655construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id540935-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">false</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1139685"></a><h3>
|
||||
<a name="id540750-bb"></a><code class="computeroutput">call_if_statement</code> public member functions</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">result_of</span><span class="special"><</span> <span class="identifier">Else</span><span class="special">(</span><span class="special">)</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <a name="id540716-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>The <code class="computeroutput">result_of<Else()>::type</code> expression should be evaluated only when the static predicate is already checked to be <code class="computeroutput">false</code> (because <code class="computeroutput">Else()</code> is required to compile only in that case). Thus, this result-of expression is evaluated lazily only in instantiations of this template specialization.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">false</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A copy of the value returned by the call to the else-branch functor template <code class="computeroutput">f()</code>. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">ElseIfPred</span><span class="special">,</span> <span class="identifier">ElseIfThen</span> <span class="special">></span> <a name="id540766-bb"></a><span class="identifier">else_if_c</span><span class="special">(</span><span class="identifier">ElseIfThen</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a static boolean predicate). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed if and only if <code class="computeroutput">ElseIfPred</code> is <code class="computeroutput">true</code> (because the if-statement static predicate is already <code class="computeroutput">false</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, this will be the return value of the functor template call being compiled and executed. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="identifier">ElseIfPred</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> <span class="identifier">ElseIfThen</span> <span class="special">></span>
|
||||
<a name="id540856-bb"></a><span class="identifier">else_if</span><span class="special">(</span><span class="identifier">ElseIfThen</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a nullary boolen meta-function). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed if and only if <code class="computeroutput">ElseIfPred::value</code> is <code class="computeroutput">true</code> (because the if-statement static predicate is already <code class="computeroutput">false</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, this will be the return value of the functor template call being compiled and executed. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id540910.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Struct template call_if_statement<true, Then, internal_type></title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_statement_id540655.html" title="Struct template call_if_statement<false, Then, internal_type>">
|
||||
<link rel="next" href="call_if_statement_id541049.html" title="Struct template call_if_statement<true, Then, ThenResult>">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id540655.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id541049.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_statement_id540910"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Struct template call_if_statement<true, Then, internal_type></span></h2>
|
||||
<p>boost::contract::call_if_statement<true, Then, internal_type> — Dispatch between then-branch functor template calls that return void and the ones that return non-void. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="call_if_statement_id540910.html" title="Struct template call_if_statement<true, Then, internal_type>">call_if_statement</a><span class="special"><</span><span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">internal_type</span><span class="special">></span> <span class="special">:</span> <span class="keyword">public</span> boost::contract::call_if_statement< true, Then, result_of< Then()>::type >
|
||||
<span class="special">{</span>
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id540910.html#boost.contract.call_if_statement_id540910construct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="call_if_statement_id540910.html#id540983-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1146281"></a><h2>Description</h2>
|
||||
<p>The base class is a call-if statement so the else and else-if statements can be specified if needed. Usually this class template is instantiated only via the return value of <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>The <code class="computeroutput">result_of<Then()>::type</code> expression should be evaluated only when the static predicate is already checked to be <code class="computeroutput">true</code> (because <code class="computeroutput">Then()</code> is required to compile only in that case). Thus, this template specialization introduces an extra level of indirection necessary for the proper lazy evaluation of this result-of expression.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1146331"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
|
||||
<p>Type of functor template to call when the static predicate is <code class="computeroutput">true</code> (as it is for this template specialization). </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1146367"></a><h3>
|
||||
<a name="boost.contract.call_if_statement_id540910construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id540983-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is compiled and called in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id540655.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id541049.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Struct template call_if_statement<true, Then, ThenResult></title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_statement_id540910.html" title="Struct template call_if_statement<true, Then, internal_type>">
|
||||
<link rel="next" href="call_if_statement_id541344.html" title="Struct template call_if_statement<true, Then, void>">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id540910.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id541344.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_statement_id541049"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Struct template call_if_statement<true, Then, ThenResult></span></h2>
|
||||
<p>boost::contract::call_if_statement<true, Then, ThenResult> — Handle static predicates that are <code class="computeroutput">true</code> for then-branch functor template calls that do not return void. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Then<span class="special">,</span> <span class="keyword">typename</span> ThenResult<span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="call_if_statement_id541049.html" title="Struct template call_if_statement<true, Then, ThenResult>">call_if_statement</a><span class="special"><</span><span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id541049.html#boost.contract.call_if_statement_id541049construct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="call_if_statement_id541049.html#id541319-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span><span class="special">)</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id541049.html#id541129-bb">public member functions</a></span>
|
||||
<a class="link" href="call_if_statement_id541049.html#id541103-bb"><span class="keyword">operator</span> <span class="identifier">ThenResult</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">ThenResult</span> <a class="link" href="call_if_statement_id541049.html#id541112-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">></span>
|
||||
<a class="link" href="call_if_statement_id541049.html#id541183-bb"><span class="identifier">else_if_c</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">></span>
|
||||
<a class="link" href="call_if_statement_id541049.html#id541243-bb"><span class="identifier">else_if</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1144634"></a><h2>Description</h2>
|
||||
<p>Usually this class template is instantiated only via the return value of <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1144667"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
|
||||
<p>Type of functor template to call when the static predicate is <code class="computeroutput">true</code> (as it is for this template specialization). </p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> ThenResult</pre>
|
||||
<p>Non-void return type of the then-branch functor template call. </p>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1144692"></a><h3>
|
||||
<a name="boost.contract.call_if_statement_id541049construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id541319-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1144793"></a><h3>
|
||||
<a name="id541129-bb"></a><code class="computeroutput">call_if_statement</code> public member functions</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id541103-bb"></a><span class="keyword">operator</span> <span class="identifier">ThenResult</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>This implicit type conversion returns a copy of the value returned by the call to the then-branch functor template. </li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">ThenResult</span> <a name="id541112-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A copy of the value returned by the call to the then-branch functor template (because the else-branch functor template call is not executed in this case). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">></span>
|
||||
<a name="id541183-bb"></a><span class="identifier">else_if_c</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a static boolean predicate). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">ThenResult</span> <span class="special">></span>
|
||||
<a name="id541243-bb"></a><span class="identifier">else_if</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a nullary boolean meta-function). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the <code class="computeroutput">ThenResult</code> type.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id540910.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_statement_id541344.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Struct template call_if_statement<true, Then, void></title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if_statement_id541049.html" title="Struct template call_if_statement<true, Then, ThenResult>">
|
||||
<link rel="next" href="call_if_c.html" title="Function template call_if_c">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id541049.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_c.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.call_if_statement_id541344"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Struct template call_if_statement<true, Then, void></span></h2>
|
||||
<p>boost::contract::call_if_statement<true, Then, void> — Handle static predicates that are <code class="computeroutput">true</code> for then-branch functor template calls that return void. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="call_if_statement_id541344.html" title="Struct template call_if_statement<true, Then, void>">call_if_statement</a><span class="special"><</span><span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id541344.html#boost.contract.call_if_statement_id541344construct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">explicit</span> <a class="link" href="call_if_statement_id541344.html#id539299-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span><span class="special">)</span><span class="special">;</span>
|
||||
|
||||
<span class="comment">// <a class="link" href="call_if_statement_id541344.html#id541402-bb">public member functions</a></span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="keyword">void</span> <a class="link" href="call_if_statement_id541344.html#id541368-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span> <a class="link" href="call_if_statement_id541344.html#id541466-bb"><span class="identifier">else_if_c</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span> <a class="link" href="call_if_statement_id541344.html#id539287-bb"><span class="identifier">else_if</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1145706"></a><h2>Description</h2>
|
||||
<p>Usually this class template is instantiated only via the return value of <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1145743"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Then</pre>
|
||||
<p>Type of functor template to call when the static predicate if <code class="computeroutput">true</code> (as it is for this template specialization). </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1145773"></a><h3>
|
||||
<a name="boost.contract.call_if_statement_id541344construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id539299-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be <code class="computeroutput">void</code> in this case (because the then-branch functor template calls return void for this template specialization). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1145852"></a><h3>
|
||||
<a name="id541402-bb"></a><code class="computeroutput">call_if_statement</code> public member functions</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="keyword">void</span> <a name="id541368-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be <code class="computeroutput">void</code> in this case (because the then-branch functor template calls return void for this template specialization). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span> <a name="id541466-bb"></a><span class="identifier">else_if_c</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a static boolean predicate). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be <code class="computeroutput">void</code> in this case (because the then-branch functor template calls return void for this template specialization).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will return void in this case (because the then-branch functor template calls return void for this template specialization). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
|
||||
<a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span> <a name="id539287-bb"></a><span class="identifier">else_if</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a nullary boolean meta-function). <p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled and executed in this case (because the if-statement static predicate is <code class="computeroutput">true</code> for this template specialization). The return type of <code class="computeroutput">f()</code> must be <code class="computeroutput">void</code> in this case (because the then-branch functor template calls return void for this template specialization).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
|
||||
<td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will return void in this case (because the then-branch functor template calls return void for this template specialization). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if_statement_id541049.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="call_if_c.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+327
@@ -0,0 +1,327 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class check</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.check_hpp" title="Header <boost/contract/check.hpp>">
|
||||
<link rel="prev" href="condition_if.html" title="Function template condition_if">
|
||||
<link rel="next" href="constructor.html" title="Function template constructor">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="condition_if.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.check_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="constructor.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.check"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class check</span></h2>
|
||||
<p>boost::contract::check — RAII object that checks the contracts. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.check_hpp" title="Header <boost/contract/check.hpp>">boost/contract/check.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">class</span> <a class="link" href="check.html" title="Class check">check</a> <span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="comment">// <a class="link" href="check.html#boost.contract.checkconstruct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <a class="link" href="check.html#id543055-bb"><span class="identifier">check</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="check.html#id543084-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="check.html" title="Class check">check</a> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a class="link" href="check.html#id543156-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_precondit_id548561.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a class="link" href="check.html#id543178-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_old_postc_id545028.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a class="link" href="check.html#id543266-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_postcondi_id545255.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="check.html#id543275-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="check.html#id543353-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<a class="link" href="check.html#id543401-bb"><span class="special">~</span><span class="identifier">check</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1148988"></a><h2>Description</h2>
|
||||
<p>In general, when this object is constructed it checks class invariants at entry, preconditions, and makes old value copies at body. When it is destructed, it checks class invariants at exist, postconditions, and exception guarantees. This object enforces the following (see also <a class="link" href="../../boost_contract/contract_programming_overview.html" title="Contract Programming Overview"> Contract Programming Overview</a>):</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem"><p>Postconditions are checked only if the body does not throw an exception. </p></li>
|
||||
<li class="listitem"><p>Exceptions guarantees are checked only if the body throws an exception. </p></li>
|
||||
<li class="listitem"><p>Constructor entry never checks class invariants. </p></li>
|
||||
<li class="listitem"><p>Destructor exit checks class invariants only if the body throws an exception. </p></li>
|
||||
<li class="listitem"><p>Static invariants are always checked at entry and exit (and regardless of the body throwing exceptions or not).</p></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This object is usually constructed initializing it to the return value of one of the contract functions <code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code>, <code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code>, <code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code>, or <code class="computeroutput"><a class="link" href="public_function_id548174.html" title="Function template public_function">boost::contract::public_function</a></code>. In addition, this object can be constructed from a nullary functor that is used to program implementation checks.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html" title="Tutorial"> Tutorial</a>, <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks"> Implementation Checks</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1149059"></a><h3>
|
||||
<a name="boost.contract.checkconstruct-copy-destruct"></a><code class="computeroutput">check</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <a name="id543055-bb"></a><span class="identifier">check</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object for implementation checks. <p>This can be used to program checks within implementation code (body, etc.). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Nullary functor that asserts implementation checks. <code class="computeroutput">f()</code> will be called as soon as this object is constructed at the point it is declared within the implementation code. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id543084-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="check.html" title="Class check">check</a> <span class="keyword">const</span> <span class="special">&</span> other<span class="special">)</span><span class="special">;</span></pre>Construct this object copying it from the specified one. <p>This object will check the contract, the copied-from object will not (i.e., contract check ownership is transferred from the copied object to the new object being created by this constructor).</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
|
||||
<td><p>Copied-from object. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a name="id543156-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_precondit_id548561.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if they apply to the specified contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
|
||||
<td><p>Contract to be checked.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
|
||||
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function. Otherwise, this is always <code class="computeroutput">void</code>. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a name="id543178-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_old_postc_id545028.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if they apply to the specified contract) and preconditions. This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
|
||||
<td><p>Contract to be checked.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
|
||||
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function. Otherwise, this is always <code class="computeroutput">void</code>. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> VirtualResult<span class="special">></span>
|
||||
<a name="id543266-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_postcondi_id545255.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special"><</span> <span class="identifier">VirtualResult</span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if they apply to the specified contract) and preconditions, then it makes old value copies at body. This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
|
||||
<td><p>Contract to be checked.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
|
||||
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function. Otherwise, this is always <code class="computeroutput">void</code>. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id543275-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <span class="keyword">const</span> <span class="special">&</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if they apply to the specified contract) and preconditions, then it makes old value copies at body. (plus the destructor of this object will check postconditions in this case). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
|
||||
<td><p>Contract to be checked.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id543353-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <span class="keyword">const</span> <span class="special">&</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if they apply to the specified contract) and preconditions, then it makes old value copies at body. (plus the destructor of this object will check postconditions and exception guarantees in this case). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use operator <code class="computeroutput">=</code> syntax.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>).</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
|
||||
<td><p>Contract to be checked.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id543401-bb"></a><span class="special">~</span><span class="identifier">check</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p>This checks class invariants at exit and either postconditions when the enclosing function body did not throw an exception, or exception guarantees when the function body threw an exception (that is if class invariants, postconditions, and exception guarantees respectively apply to the object specified when constructing this object).</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw (it is declared <code class="computeroutput">noexcept(false)</code>) in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)">
|
||||
Throw on Failure</a>). </p>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="condition_if.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.check_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="constructor.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function check_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="get_check_failure.html" title="Function get_check_failure">
|
||||
<link rel="next" href="set_precondition_failure.html" title="Function set_precondition_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_check_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_precondition_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.check_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function check_failure</span></h2>
|
||||
<p>boost::contract::check_failure — Call failure handler for implementation checks. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">void</span> <span class="identifier">check_failure</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1161749"></a><h2>Description</h2>
|
||||
<p>This is often called only internally by this library.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify a failure handler that throws exceptions on contract assertion failures (not the default).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks"> Implementation Checks</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_check_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_precondition_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template condition_if</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="condition_if_c.html" title="Function template condition_if_c">
|
||||
<link rel="next" href="check.html" title="Class check">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="condition_if_c.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="check.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.condition_if"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template condition_if</span></h2>
|
||||
<p>boost::contract::condition_if — Select compilation and execution of a boolean functor template condition using a nullary boolean meta-function. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">condition_if</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">,</span> <span class="keyword">bool</span> else_ <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1148345"></a><h2>Description</h2>
|
||||
<p>Compile and execute the nullary boolean functor template call <code class="computeroutput">f()</code> if and only if the specified nullary boolean meta-function <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>, otherwise trivially return <code class="computeroutput">else_</code> (<code class="computeroutput">true</code> by default) at run-time. This is equivalent to <code class="computeroutput">boost::contract::condition_if_c<Pred::value>(f, else_)</code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">else_</code></span></p></td>
|
||||
<td><p>Boolean value to return when <code class="computeroutput">Pred::value</code> is <code class="computeroutput">false</code> (instead of compiling and executing the functor template call <code class="computeroutput">f()</code>).</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Nullary boolean functor template. The functor template call <code class="computeroutput">f()</code> is compiled and executed if and only if <code class="computeroutput">Pred::value</code> is <code class="computeroutput">true</code>. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Pred</code></span></p></td>
|
||||
<td><p>Nullary boolean meta-function selecting when the functor template call <code class="computeroutput">f()</code> should be compiled and executed.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>Boolean value returned by <code class="computeroutput">f()</code> if the static predicate <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>. Otherwise, trivially return <code class="computeroutput">else_</code>. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="condition_if_c.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="check.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template condition_if_c</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
|
||||
<link rel="prev" href="call_if.html" title="Function template call_if">
|
||||
<link rel="next" href="condition_if.html" title="Function template condition_if">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="condition_if.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.condition_if_c"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template condition_if_c</span></h2>
|
||||
<p>boost::contract::condition_if_c — Select compilation and execution of a boolean functor template condition using a static boolean predicate. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> Pred<span class="special">,</span> <span class="keyword">typename</span> Then<span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">condition_if_c</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">,</span> <span class="keyword">bool</span> else_ <span class="special">=</span> <span class="keyword">true</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1148070"></a><h2>Description</h2>
|
||||
<p>Compile and execute the nullary boolean functor template call <code class="computeroutput">f()</code> if and only if the specified static boolean predicate <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>, otherwise trivially return <code class="computeroutput">else_</code> (<code class="computeroutput">true</code> by default) at run-time. A call to <code class="computeroutput">boost::contract::condition_if_c<Pred>(f, b)</code> is logically equivalent to <code class="computeroutput">boost::contract::call_if_c<Pred>(f, [b] { return b; })</code> (but its implementation is optimized with respsect to the <code class="computeroutput">call_if_c</code> equivalent).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
|
||||
Assertion Requirements</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">else_</code></span></p></td>
|
||||
<td><p>Boolean value to return when <code class="computeroutput">Pred</code> is <code class="computeroutput">false</code> (instead of compiling and executing the functor template call <code class="computeroutput">f()</code>).</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Nullary boolean functor template. The functor template call <code class="computeroutput">f()</code> is compiled and executed if and only if <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>.</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Pred</code></span></p></td>
|
||||
<td><p>Static boolean predicate selecting when the functor template call <code class="computeroutput">f()</code> should be compiled and executed. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>Boolean value returned by <code class="computeroutput">f()</code> if the static predicate <code class="computeroutput">Pred</code> is <code class="computeroutput">true</code>. Otherwise, trivially return <code class="computeroutput">else_</code>. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="call_if.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="condition_if.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template constructor</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.constructor_hpp" title="Header <boost/contract/constructor.hpp>">
|
||||
<link rel="prev" href="check.html" title="Class check">
|
||||
<link rel="next" href="access.html" title="Class access">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="check.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.constructor_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="access.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.constructor"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template constructor</span></h2>
|
||||
<p>boost::contract::constructor — Program contracts for constructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.constructor_hpp" title="Header <boost/contract/constructor.hpp>">boost/contract/constructor.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Class<span class="special">></span>
|
||||
<a class="link" href="specify_old_postc_id545028.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a> <span class="identifier">constructor</span><span class="special">(</span><span class="identifier">Class</span> <span class="special">*</span> obj<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1152884"></a><h2>Description</h2>
|
||||
<p>This is used to specify postconditions, exception guarantees, old value copies at body, and check class invariants for constructors (see <code class="computeroutput"><code class="computeroutput"><a class="link" href="constructor_precondition.html" title="Class template constructor_precondition">boost::contract::constructor_precondition</a></code></code> to specify preconditions for constructors instead).</p>
|
||||
<p>For optimization, this can be omitted for constructors that do not have postconditions and exception guarantees, within classes that have no invariants.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.constructors" title="Constructors"> Constructors</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">obj</code></span></p></td>
|
||||
<td><p>The object <code class="computeroutput">this</code> from the scope of the enclosing constructor declaring the contract. (Constructors check all class invariants, including static and volatile invariants, see also <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants">
|
||||
Class Invariants</a> and <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Class</code></span></p></td>
|
||||
<td><p>The type of the class containing the constructor declaring the contract. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.)</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>The result of this function must be explicitly assigned to a variable of type <code class="computeroutput"><a class="link" href="check.html" title="Class check">boost::contract::check</a></code> declared locally just before the code of the constructor body (otherwise this library will generate a run-time error, see <code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html" title="Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL">BOOST_CONTRACT_ON_MISSING_CHECK_DECL</a></code>). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="check.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.constructor_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="access.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class template constructor_precondition</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.constructor_precondition_hpp" title="Header <boost/contract/core/constructor_precondition.hpp>">
|
||||
<link rel="prev" href="../../BOOST_CONTRACT_DYN_LINK.html" title="Macro BOOST_CONTRACT_DYN_LINK">
|
||||
<link rel="next" href="assertion_failure.html" title="Class assertion_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../../BOOST_CONTRACT_DYN_LINK.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.constructor_precondition_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assertion_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.constructor_precondition"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class template constructor_precondition</span></h2>
|
||||
<p>boost::contract::constructor_precondition — Program preconditions for constructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.constructor_precondition_hpp" title="Header <boost/contract/core/constructor_precondition.hpp>">boost/contract/core/constructor_precondition.hpp</a>>
|
||||
|
||||
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Class<span class="special">></span>
|
||||
<span class="keyword">class</span> <a class="link" href="constructor_precondition.html" title="Class template constructor_precondition">constructor_precondition</a> <span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="comment">// <a class="link" href="constructor_precondition.html#boost.contract.constructor_preconditionconstruct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<a class="link" href="constructor_precondition.html#id542958-bb"><span class="identifier">constructor_precondition</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <span class="keyword">explicit</span> <a class="link" href="constructor_precondition.html#id542940-bb"><span class="identifier">constructor_precondition</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1154269"></a><h2>Description</h2>
|
||||
<p>This class must be the very first base of the class declaring the constructor for which preconditions are programmed (that way constructor arguments can be checked by preconditions even before they are used to initialize other base classes). User-defined classes should inherit privately from this class (to not alter the public interface of user-defined classes). In addition, this class should never be declared as a virtual base (because virtual bases are initialized only once across the entire inheritance hierarchy preventing preconditions of other base classes from being checked).</p>
|
||||
<p>Unions cannot have base classes in C++ so this class can be used to declare a local object within the constructor definition just before <code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code> is used (see <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.unions" title="Unions"> Unions</a>).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.constructors" title="Constructors"> Constructors</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1154287"></a><h3>Template Parameters</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">typename</span> Class</pre>
|
||||
<p>The class type of the constructor for which preconditions are being programmed. </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
<div class="refsect2">
|
||||
<a name="id1154350"></a><h3>
|
||||
<a name="boost.contract.constructor_preconditionconstruct-copy-destruct"></a><code class="computeroutput">constructor_precondition</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><a name="id542958-bb"></a><span class="identifier">constructor_precondition</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Construct this object without specifying constructor preconditions. <p>This is implicitly called for those constructors of the contracted class that do not specify preconditions.</p>
|
||||
<div class="note"><table border="0" summary="Note">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
|
||||
<th align="left">Note</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>Calling this default constructor should amount to negligible compile-time and run-time overheads (likely to be optimized away completely by most compilers). </p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
</p>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <span class="keyword">explicit</span> <a name="id542940-bb"></a><span class="identifier">constructor_precondition</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object specifying constructor preconditions. <p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
|
||||
<td><p>Nullary functor called by this library to check constructor preconditions <code class="computeroutput">f()</code>. Assertions within this functor call are usually programmed using <code class="computeroutput"><code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code></code>, but any exception thrown by a call to this functor indicates a contract failure (and will result in this library calling <code class="computeroutput"><code class="computeroutput"><a class="link" href="precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code></code>). This functor should capture variables by (constant) value, or better by (constant) reference to avoid extra copies. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</li>
|
||||
</ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../../BOOST_CONTRACT_DYN_LINK.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.constructor_precondition_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assertion_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function copy_old</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">
|
||||
<link rel="prev" href="make_old_id549965.html" title="Function make_old">
|
||||
<link rel="next" href="copy_old_id547817.html" title="Function copy_old">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="make_old_id549965.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.old_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="copy_old_id547817.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.copy_old_id547797"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function copy_old</span></h2>
|
||||
<p>boost::contract::copy_old — Check if old values need to be copied (but not for virtual public functions and public function overrides). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">boost/contract/old.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">copy_old</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177275"></a><h2>Description</h2>
|
||||
<p>For example, this function always returns false when both postconditions and exception guarantees are not being checked (see also <code class="computeroutput"><code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">BOOST_CONTRACT_NO_OLDS</a></code></code>). This function is often only used by the code expanded by <code class="computeroutput">BOOST_CONTRACT_OLDOF</code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.no_macros__and_no_variadic_macros_" title="No Macros (and No Variadic Macros)"> No Macros</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>True if old values need to be copied, false otherwise. </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="make_old_id549965.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.old_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="copy_old_id547817.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function copy_old</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">
|
||||
<link rel="prev" href="copy_old_id547797.html" title="Function copy_old">
|
||||
<link rel="next" href="../../BOOST_CONTRACT_OLDOF.html" title="Macro BOOST_CONTRACT_OLDOF">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="copy_old_id547797.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.old_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../BOOST_CONTRACT_OLDOF.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.copy_old_id547817"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function copy_old</span></h2>
|
||||
<p>boost::contract::copy_old — Check if old values need to be copied (for virtual public functions and public function overrides). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.old_hpp" title="Header <boost/contract/old.hpp>">boost/contract/old.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">copy_old</span><span class="special">(</span><a class="link" href="virtual_.html" title="Class virtual_">virtual_</a> <span class="special">*</span> v<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1177380"></a><h2>Description</h2>
|
||||
<p>For example, this function always returns false when both postconditions and exception guarantees are not being checked (see also <code class="computeroutput"><code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_NO_OLDS.html" title="Macro BOOST_CONTRACT_NO_OLDS">BOOST_CONTRACT_NO_OLDS</a></code></code>). In addition, this function returns false when overridden functions are being called subsequent times by this library to support subcontracting. This function is often only used by the code expanded by <code class="computeroutput">BOOST_CONTRACT_OLDOF</code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.no_macros__and_no_variadic_macros_" title="No Macros (and No Variadic Macros)"> No Macros</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">v</code></span></p></td>
|
||||
<td><p>The trailing parameter of type <code class="computeroutput"><code class="computeroutput"><a class="link" href="virtual_.html" title="Class virtual_">boost::contract::virtual_</a></code></code><code class="computeroutput">*</code> and default value <code class="computeroutput">0</code> from the enclosing virtual or overriding public function declaring the contract.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>True if old values need to be copied, false otherwise. </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="copy_old_id547797.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.old_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../BOOST_CONTRACT_OLDOF.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function template destructor</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.destructor_hpp" title="Header <boost/contract/destructor.hpp>">
|
||||
<link rel="prev" href="virtual_.html" title="Class virtual_">
|
||||
<link rel="next" href="function.html" title="Function function">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="virtual_.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.destructor_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="function.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.destructor"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function template destructor</span></h2>
|
||||
<p>boost::contract::destructor — Program contracts for destructors. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.destructor_hpp" title="Header <boost/contract/destructor.hpp>">boost/contract/destructor.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Class<span class="special">></span>
|
||||
<a class="link" href="specify_old_postc_id545028.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a> <span class="identifier">destructor</span><span class="special">(</span><span class="identifier">Class</span> <span class="special">*</span> obj<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1170700"></a><h2>Description</h2>
|
||||
<p>This is used to specify postconditions, exception guarantees, old value copies at body, and check class invariants for destructors (destructors cannot not have preconditions, see <a class="link" href="../../boost_contract/contract_programming_overview.html" title="Contract Programming Overview"> Contract Programming Overview</a>).</p>
|
||||
<p>For optimization, this can be omitted for destructors that do not have postconditions and exception guarantees, within classes that have no invariants.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.destructors" title="Destructors"> Destructors</a></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">obj</code></span></p></td>
|
||||
<td><p>The object <code class="computeroutput">this</code> from the scope of the enclosing destructor declaring the contract. (Destructors check all class invariants, including static and volatile invariants, see also <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants">
|
||||
Class Invariants</a> and <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a>).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Template Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">Class</code></span></p></td>
|
||||
<td><p>The type of the class containing the destructor declaring the contract. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.)</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>The result of this function must be explicitly assigned to a variable of type <code class="computeroutput"><a class="link" href="check.html" title="Class check">boost::contract::check</a></code> declared locally just before the code of the destructor body (otherwise this library will generate a run-time error, see <code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html" title="Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL">BOOST_CONTRACT_ON_MISSING_CHECK_DECL</a></code>). </p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="virtual_.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.destructor_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="function.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function entry_invariant_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="get_entry_invaria_id544506.html" title="Function get_entry_invariant_failure">
|
||||
<link rel="next" href="set_exit_invariant_failure.html" title="Function set_exit_invariant_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_entry_invaria_id544506.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_exit_invariant_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.entry_invariant_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function entry_invariant_failure</span></h2>
|
||||
<p>boost::contract::entry_invariant_failure — Call failure handler for class invariants at entry. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">void</span> <span class="identifier">entry_invariant_failure</span><span class="special">(</span><span class="identifier">from</span> where<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1165272"></a><h2>Description</h2>
|
||||
<p>This is often called only internally by this library.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify a failure handler that throws exceptions on contract assertion failures (not the default).</p>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">where</code></span></p></td>
|
||||
<td><p>Operation that failed the contract assertion (e.g., this might be useful to program failure handler functors that never throw from destructors, not even when they are programmed by users to throw exceptions instead of terminating the program).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_entry_invaria_id544506.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_exit_invariant_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function except_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="get_except_failure.html" title="Function get_except_failure">
|
||||
<link rel="next" href="set_old_failure.html" title="Function set_old_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_except_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_old_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.except_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function except_failure</span></h2>
|
||||
<p>boost::contract::except_failure — Call failure handler for exception guarantees. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">void</span> <span class="identifier">except_failure</span><span class="special">(</span><span class="identifier">from</span> where<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1162808"></a><h2>Description</h2>
|
||||
<p>This is often called only internally by this library.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify a failure handler that throws exceptions on contract assertion failures (not the default), however:</p>
|
||||
<div class="warning"><table border="0" summary="Warning">
|
||||
<tr>
|
||||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../doc/src/images/warning.png"></td>
|
||||
<th align="left">Warning</th>
|
||||
</tr>
|
||||
<tr><td align="left" valign="top"><p>When this failure handler is called there is already an active exception (the one that caused the exception guarantees to be checked in the first place). Therefore, programming this failure handler to throw yet another exception will force C++ to always terminate the program.</p></td></tr>
|
||||
</table></div>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exception Guarantees</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">where</code></span></p></td>
|
||||
<td><p>Operation that failed the contract assertion.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_except_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_old_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Class exception</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="bad_virtual_result_cast.html" title="Class bad_virtual_result_cast">
|
||||
<link rel="next" href="from.html" title="Type from">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bad_virtual_result_cast.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="from.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.exception"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Class exception</span></h2>
|
||||
<p>boost::contract::exception — Public base class for all exceptions directly thrown by this library. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">class</span> <a class="link" href="exception.html" title="Class exception">exception</a> <span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="comment">// <a class="link" href="exception.html#boost.contract.exceptionconstruct-copy-destruct">construct/copy/destruct</a></span>
|
||||
<a class="link" href="exception.html#id545712-bb"><span class="special">~</span><span class="identifier">exception</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
|
||||
<span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1163279"></a><h2>Description</h2>
|
||||
<p>This class does not inherit from <code class="computeroutput">std::exception</code> because exceptions deriving from this class will (inheriting from <code class="computeroutput">std::exception</code>, <code class="computeroutput">std::bad_cast</code>, etc.).</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <code class="computeroutput"><a class="link" href="assertion_failure.html" title="Class assertion_failure">boost::contract::assertion_failure</a></code>, <code class="computeroutput"><a class="link" href="bad_virtual_result_cast.html" title="Class bad_virtual_result_cast">boost::contract::bad_virtual_result_cast</a></code>, etc. </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="refsect2">
|
||||
<a name="id1163318"></a><h3>
|
||||
<a name="boost.contract.exceptionconstruct-copy-destruct"></a><code class="computeroutput">exception</code>
|
||||
public
|
||||
construct/copy/destruct</h3>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
|
||||
<pre class="literallayout"><a name="id545712-bb"></a><span class="special">~</span><span class="identifier">exception</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11). </p>
|
||||
</li></ol></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bad_virtual_result_cast.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="from.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function exit_invariant_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="get_exit_invariant_failure.html" title="Function get_exit_invariant_failure">
|
||||
<link rel="next" href="set_invariant_failure.html" title="Function set_invariant_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_exit_invariant_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_invariant_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.exit_invariant_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function exit_invariant_failure</span></h2>
|
||||
<p>boost::contract::exit_invariant_failure — Call failure handler for class invariants at exit. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">void</span> <span class="identifier">exit_invariant_failure</span><span class="special">(</span><span class="identifier">from</span> where<span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1165654"></a><h2>Description</h2>
|
||||
<p>This is often called only internally by this library.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify a failure handler that throws exceptions on contract assertion failures (not the default).</p>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.class_invariants" title="Class Invariants"> Class Invariants</a>, <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.volatile_public_functions" title="Volatile Public Functions">
|
||||
Volatile Public Functions</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Parameters:</span></p></td>
|
||||
<td><div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term"><code class="computeroutput">where</code></span></p></td>
|
||||
<td><p>Operation that failed the contract assertion (e.g., this might be useful to program failure handler functors that never throw from destructors, not even when they are programmed by users to throw exceptions instead of terminating the program).</p></td>
|
||||
</tr></tbody>
|
||||
</table></div></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get_exit_invariant_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_invariant_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type definition failure_handler</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="from_failure_handler.html" title="Type definition from_failure_handler">
|
||||
<link rel="next" href="set_check_failure.html" title="Function set_check_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="from_failure_handler.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_check_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.failure_handler"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Type definition failure_handler</span></h2>
|
||||
<p>failure_handler — Type of assertion failure handler functions (without <code class="computeroutput">from</code> parameter). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">void</span><span class="special">(</span><span class="special">)</span><span class="special">></span> <span class="identifier">failure_handler</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1161427"></a><h2>Description</h2>
|
||||
<p>Assertion failure handler functions specified by this type must be nullary functors returning <code class="computeroutput">void</code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="from_failure_handler.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="set_check_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type from</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="exception.html" title="Class exception">
|
||||
<link rel="next" href="from_failure_handler.html" title="Type definition from_failure_handler">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="exception.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="from_failure_handler.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.from"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Type from</span></h2>
|
||||
<p>boost::contract::from — Indicate the kind of operation where the contract assertion failed. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
|
||||
<span class="keyword">enum</span> <span class="identifier">from</span> <span class="special">{</span> <a class="link" href="from.html#boost.contract.from.from_constructor">from_constructor</a>, <a class="link" href="from.html#boost.contract.from.from_destructor">from_destructor</a>, <a class="link" href="from.html#boost.contract.from.from_function">from_function</a> <span class="special">}</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1163413"></a><h2>Description</h2>
|
||||
<p>This is passed as a parameter to the assertion failure handler functions. For example, it might be necessary to know in which operation an assertion failed to make sure exceptions are never thrown from destructors, not even when contract failure handlers are programmed by users to throw exceptions instead of terminating the program.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><dl class="variablelist compact">
|
||||
<dt><span class="term"><code class="computeroutput">from_constructor</code><a name="boost.contract.from.from_constructor"></a></span></dt>
|
||||
<dd>Assertion failed when checking contracts for constructors. </dd>
|
||||
<dt><span class="term"><code class="computeroutput">from_destructor</code><a name="boost.contract.from.from_destructor"></a></span></dt>
|
||||
<dd>Assertion failed when checking contracts for destructors . </dd>
|
||||
<dt><span class="term"><code class="computeroutput">from_function</code><a name="boost.contract.from.from_function"></a></span></dt>
|
||||
<dd>Assertion failed when checking contracts for functions (members or not). </dd>
|
||||
</dl></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="exception.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="from_failure_handler.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type definition from_failure_handler</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="from.html" title="Type from">
|
||||
<link rel="next" href="failure_handler.html" title="Type definition failure_handler">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="from.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="failure_handler.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.from_failure_handler"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Type definition from_failure_handler</span></h2>
|
||||
<p>from_failure_handler — Type of assertion failure handler functions (with <code class="computeroutput">from</code> parameter). </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">void</span><span class="special">(</span><span class="identifier">from</span><span class="special">)</span><span class="special">></span> <span class="identifier">from_failure_handler</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1161329"></a><h2>Description</h2>
|
||||
<p>Assertion failure handler functions specified by this type must be functors returning <code class="computeroutput">void</code> and taking a single parameter of type <code class="computeroutput"><a class="link" href="from.html" title="Type from">boost::contract::from</a></code>.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="from.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="failure_handler.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function function</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.function_hpp" title="Header <boost/contract/function.hpp>">
|
||||
<link rel="prev" href="destructor.html" title="Function template destructor">
|
||||
<link rel="next" href="is_old_value_copyable.html" title="Struct template is_old_value_copyable">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="destructor.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.function_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_old_value_copyable.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.function"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function function</span></h2>
|
||||
<p>boost::contract::function — Program contracts for non-member, private and protected functions. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.function_hpp" title="Header <boost/contract/function.hpp>">boost/contract/function.hpp</a>>
|
||||
|
||||
</span>
|
||||
<a class="link" href="specify_precondit_id548561.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_postcondition_except</a> <span class="identifier">function</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1170915"></a><h2>Description</h2>
|
||||
<p>This is used to specify preconditions, postconditions, exception guarantees, and old copies at body for non-member, private and protected functions (these functions never check class invariants, see <a class="link" href="../../boost_contract/contract_programming_overview.html" title="Contract Programming Overview"> Contract Programming Overview</a>). It can be used also to program contracts in implementation code for lambda functions, loops, and arbitrary blocks of code.</p>
|
||||
<p>For optimization, this can be omitted for code that does not have preconditions, postconditions, and exception guarantees.</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.non_member_functions" title="Non-Member Functions"> Non-Member Functions</a>, <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.private_and_protected_functions" title="Private and Protected Functions">
|
||||
Private and Protected Functions</a>, <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.lambdas__loops__code_blocks__and__constexpr__" title="Lambdas, Loops, Code Blocks (and constexpr)">
|
||||
Lambdas, Loops, Code Blocks</a></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>The result of this function must be explicitly assigned to a variable of type <code class="computeroutput"><a class="link" href="check.html" title="Class check">boost::contract::check</a></code> declared locally just before the function body code (otherwise this library will generate a run-time error, see <code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ON_MISSING_CHECK_DECL.html" title="Macro BOOST_CONTRACT_ON_MISSING_CHECK_DECL">BOOST_CONTRACT_ON_MISSING_CHECK_DECL</a></code>). </p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="destructor.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.function_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_old_value_copyable.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Function get_check_failure</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0">
|
||||
<link rel="up" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">
|
||||
<link rel="prev" href="set_check_failure.html" title="Function set_check_failure">
|
||||
<link rel="next" href="check_failure.html" title="Function check_failure">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../..//boost.png"></td>
|
||||
<td align="center"><a href="../../../..//index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../..//libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../..//more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="set_check_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="check_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="refentry">
|
||||
<a name="boost.contract.get_check_failure"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv">
|
||||
<h2><span class="refentrytitle">Function get_check_failure</span></h2>
|
||||
<p>boost::contract::get_check_failure — Return failure handler currently set for implementation checks. </p>
|
||||
</div>
|
||||
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
||||
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.exception_hpp" title="Header <boost/contract/core/exception.hpp>">boost/contract/core/exception.hpp</a>>
|
||||
|
||||
</span>
|
||||
<span class="identifier">failure_handler</span> <span class="identifier">get_check_failure</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre></div>
|
||||
<div class="refsect1">
|
||||
<a name="id1161653"></a><h2>Description</h2>
|
||||
<p>This is often called only internally by this library.</p>
|
||||
<p><span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">noexcept</code> (or <code class="computeroutput">throw()</code> if no C++11).</p>
|
||||
<p>
|
||||
</p>
|
||||
<p><span class="bold"><strong>See Also:</strong></span></p>
|
||||
<p> <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failure__and__noexcept__" title="Throw on Failure (and noexcept)"> Throw on Failure</a>, <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks"> Implementation Checks</a> </p>
|
||||
<p>
|
||||
</p>
|
||||
<div class="variablelist"><table border="0" class="variablelist compact">
|
||||
<colgroup>
|
||||
<col align="left" valign="top">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td><p><span class="term">Returns:</span></p></td>
|
||||
<td><p>A copy of the failure handler currently set.</p></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2008-2017 Lorenzo Caminiti<p>
|
||||
Distributed under the Boost Software License, Version 1.0 (see accompanying
|
||||
file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="set_check_failure.html"><img src="../../../..//doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.exception_hpp"><img src="../../../..//doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../..//doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="check_failure.html"><img src="../../../..//doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user