|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72314 - in sandbox/contract/libs/contract/doc/html: . contract contract__ doc doc/html doc/html/images doc/src doc/src/images doc/src/images/callouts example example/Crowl2006 example/Crowl2006/block example/Crowl2006/circle example/Crowl2006/factorial example/Crowl2006/operator_equal example/Crowl2006/sqrt example/Crowl2006/sum example/Crowl2006/vector example/Meyer1997 example/Meyer1997/gcd example/Meyer1997/maxarray example/Meyer1997/stack3 example/Meyer1997/stack4 example/Mitchell2002 example/Mitchell2002/counter example/Mitchell2002/courier example/Mitchell2002/customer_manager example/Mitchell2002/dictionary example/Mitchell2002/name_list example/Mitchell2002/observe example/Mitchell2002/simple_queue example/Mitchell2002/stack example/Stroustrup1997 example/Stroustrup1997/string example/commas example/cv example/exspecs example/extern example/friend example/inline example/myvector example/storage example/struct example/throw images images/callouts
From: lorcaminiti_at_[hidden]
Date: 2011-05-31 14:35:36
Author: lcaminiti
Date: 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
New Revision: 72314
URL: http://svn.boost.org/trac/boost/changeset/72314
Log:
Adding some temp doc.
Added:
sandbox/contract/libs/contract/doc/html/
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT_MSG.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_MSG.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_BODY.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_BLOCK_INVARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_CLASS_INVARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_POSTCONDITION.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_PRECONDITION.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR_BODY.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR_BODY.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_FUNCTION.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_INIT_LOOP_VARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_INVARIANT.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_OLDOF.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/CONTRACT_WRAP_TYPE.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/
sandbox/contract/libs/contract/doc/html/contract/block_invariant_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/class_invariant_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/constructor.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/contract_failed_handler.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/copy.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/copyable.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/destructor.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/failure.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/from.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/loop_variant_type.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/nonmember_function.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/nonstatic_member_function.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/postcondition_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/precondition_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/set_block_invariant_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/set_class_invariant_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/set_postcondition_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/set_precondition_failed.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/state.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/static_member_function.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id2358596.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436550.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436560.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436562.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436565.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436578.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436755.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436782.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437043.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437088.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437104.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437106.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437311.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437382.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437642.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439377.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439703.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/
sandbox/contract/libs/contract/doc/html/contract__/Rationale.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/bibliography.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/contract_programming.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/examples.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/getting_started.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/grammar.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/license.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/release_history.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/throw_on_failure.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/todo.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/tutorial.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/contract__/without_the_macros.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/
sandbox/contract/libs/contract/doc/html/doc/html/
sandbox/contract/libs/contract/doc/html/doc/html/boostbook.css (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/
sandbox/contract/libs/contract/doc/html/doc/html/images/alert.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/blank.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/caution.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/draft.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/home.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/important.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/next.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/next_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/note.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/prev.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/prev_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/smiley.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/tip.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/toc-blank.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/toc-minus.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/toc-plus.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/up.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/up_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/html/images/warning.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/
sandbox/contract/libs/contract/doc/html/doc/src/images/
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/1.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/10.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/11.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/12.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/13.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/14.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/15.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/2.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/3.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/4.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/5.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/6.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/7.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/8.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/9.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/block/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/block/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/circle/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/circle/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/factorial/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/factorial/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/equal.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/not_equal.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sqrt/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sqrt/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Crowl2006/vector/
sandbox/contract/libs/contract/doc/html/example/Crowl2006/vector/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Makefile (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/
sandbox/contract/libs/contract/doc/html/example/Meyer1997/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/gcd/
sandbox/contract/libs/contract/doc/html/example/Meyer1997/gcd/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/maxarray/
sandbox/contract/libs/contract/doc/html/example/Meyer1997/maxarray/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/stack3.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/stack4.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/counter.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/decrement_button.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/push_button.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/view_of_counter.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/dictionary.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/observe.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/simple_queue.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/stack.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/commas/
sandbox/contract/libs/contract/doc/html/example/commas/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/commas/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/cv/
sandbox/contract/libs/contract/doc/html/example/cv/REAME.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/cv/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/exspecs/
sandbox/contract/libs/contract/doc/html/example/exspecs/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/exspecs/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/extern/
sandbox/contract/libs/contract/doc/html/example/extern/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/extern/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/friend/
sandbox/contract/libs/contract/doc/html/example/friend/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/friend/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/inline/
sandbox/contract/libs/contract/doc/html/example/inline/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/inline/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/
sandbox/contract/libs/contract/doc/html/example/myvector/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/basic_begin.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/boundable.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/main_nomacros.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/myvector.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/myvector_nomacros.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/push_back.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/myvector/pushable.hpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/storage/
sandbox/contract/libs/contract/doc/html/example/storage/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/storage/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/struct/
sandbox/contract/libs/contract/doc/html/example/struct/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/struct/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/throw/
sandbox/contract/libs/contract/doc/html/example/throw/README.txt (contents, props changed)
sandbox/contract/libs/contract/doc/html/example/throw/main.cpp (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/
sandbox/contract/libs/contract/doc/html/images/alert.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/blank.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/
sandbox/contract/libs/contract/doc/html/images/callouts/1.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/10.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/11.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/12.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/13.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/14.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/15.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/2.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/3.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/4.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/5.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/6.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/7.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/8.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/callouts/9.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/caution.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/draft.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/home.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/important.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/next.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/next_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/note.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/prev.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/prev_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/smiley.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/tip.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/toc-blank.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/toc-minus.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/toc-plus.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/up.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/up_disabled.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/images/warning.png (contents, props changed)
sandbox/contract/libs/contract/doc/html/index.html (contents, props changed)
sandbox/contract/libs/contract/doc/html/reference.html (contents, props changed)
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,69 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="contract/postcondition_failed.html" title="Function postcondition_failed">
+<link rel="next" href="CONTRACT_ASSERT_MSG.html" title="Macro CONTRACT_ASSERT_MSG">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/postcondition_failed.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT</span></h2>
+<p>CONTRACT_ASSERT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>CONTRACT_ASSERT(boolean_condition)</pre></div>
+<div class="refsect1">
+<a name="id960732"></a><h2>Description</h2>
+<p>Macro used to assert contract conditions for class invariants, preconditions, and postconditions.</p>
+<p>Whenever possible, it is recommended to use this macro instead of throwing <code class="computeroutput"><a class="link" href="contract/failure.html" title="Class failure">contract::failure</a></code> directly. For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="keyword">true</span> <span class="special">)</span><span class="special">;</span>
+</pre>
+<p>The code asserting the specified boolean condition is used as the description of the assertion (otherwise use <code class="computeroutput">CONTRACT_ASSERT_MSG()</code>).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">boolean_condition</code></strong></span></td>
+<td>The boolean contract condition being asserted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following (see the Without the Macros section): </p>
+<pre class="programlisting"> <span class="keyword">if</span> <span class="special">(</span><span class="special">!</span><span class="special">(</span><span class="identifier">boolean_condition</span><span class="special">)</span><span class="special">)</span>
+ <span class="keyword">throw</span> <a class="link" href="contract/failure.html" title="Class failure">contract::failure</a><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">,</span> <span class="special">#</span> <span class="identifier">boolean_condition</span><span class="special">)</span><span class="special">;</span>
+</pre>
+<p> Note how <code class="computeroutput">__FILE__</code> and <code class="computeroutput">__LINE__</code> are automatically used by the macro to improve error reporting. (The preprocessor operator <code class="computeroutput">#</code> makes a string from the specified token.)</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT_MSG()</code>, <code class="computeroutput"><a class="link" href="contract/failure.html" title="Class failure">contract::failure</a></code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/postcondition_failed.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT_BLOCK_INVARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="contract/loop_variant_type.html" title="Type definition loop_variant_type">
+<link rel="next" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT_MSG">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/loop_variant_type.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT_BLOCK_INVARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT_BLOCK_INVARIANT</span></h2>
+<p>CONTRACT_ASSERT_BLOCK_INVARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>CONTRACT_ASSERT_BLOCK_INVARIANT(boolen_condition)</pre></div>
+<div class="refsect1">
+<a name="id961814"></a><h2>Description</h2>
+<p>Macro used to assert invariant contract conditions from within a code block.</p>
+<p>To assert class invariants, preconditions, and postcondition use <code class="computeroutput">CONTRACT_ASSERT()</code> instead.</p>
+<p>The code asserting the boolean condition is also used as the description of the condition. For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="special">...</span>
+ <span class="special">{</span> <span class="comment">// From within this code block.</span>
+ <span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">...</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">boolean_condition</code></strong></span></td>
+<td>The boolean contract condition being asserted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code that will automatically invoke <code class="computeroutput">contract::block_invariant_failed()</code> if the specified condition is evaluated to be <code class="computeroutput">false</code>. The macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="keyword">try</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">boolean_condition</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">catch</span> <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">block_invariant_failed</span><span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">FROM_BLOCK</span><span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT_MSG()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/loop_variant_type.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,82 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="CONTRACT_ASSERT_BLOCK_INVARIANT.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT">
+<link rel="next" href="CONTRACT_ASSERT_LOOP_VARIANT.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_BLOCK_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_LOOP_VARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</span></h2>
+<p>CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>CONTRACT_ASSERT_BLOCK_INVARIANT_MSG(boolean_condition, string_description)</pre></div>
+<div class="refsect1">
+<a name="id962189"></a><h2>Description</h2>
+<p>Macro used to assert invariant contract conditions from within a code block specifying also a human readable message.</p>
+<p>To assert class invariants, preconditions, and postcondition use <code class="computeroutput">CONTRACT_ASSERT_MSG()</code> instead.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="special">...</span>
+ <span class="special">{</span> <span class="comment">// From within this code block.</span>
+ <span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</span><span class="special">(</span> <span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">,</span> <span class="string">"x is zero"</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">...</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">boolean_condition</code></strong></span></td>
+<td>The boolean contract condition being asserted. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">string_description</code></strong></span></td>
+<td>A string providing a human readable description of the condition being asserted. (used for error reporting). </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code that will automatically invoke <code class="computeroutput">contract::block_invariant_failed()</code> if the specified condition is evaluated to be <code class="computeroutput">false</code>. The macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="keyword">try</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_ASSERT_MSG</span><span class="special">(</span> <span class="identifier">boolean_condition</span><span class="special">,</span> <span class="identifier">string_description</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">catch</span> <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">block_invariant_failed</span><span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">FROM_BLOCK</span><span class="special">)</span><span class="special">;</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_BLOCK_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_LOOP_VARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT_LOOP_VARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT_MSG">
+<link rel="next" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT_MSG">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT_LOOP_VARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT_LOOP_VARIANT</span></h2>
+<p>CONTRACT_ASSERT_LOOP_VARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>CONTRACT_ASSERT_LOOP_VARIANT(integer_expression)</pre></div>
+<div class="refsect1">
+<a name="id962603"></a><h2>Description</h2>
+<p>Macro used to assert loop variant.</p>
+<p>At each loop iteration, the value of the specified loop variant expression is automatically evaluated and asserted to be positive (<code class="computeroutput">> 0</code>) and to decrease (<code class="computeroutput"><</code>) from the variant value at previous loop iteration. A loop can only have one variant.</p>
+<p><span class="bold"><strong>Note:</strong></span> Loop variants can be used to check <span class="bold"><strong>loop correctness</strong></span> (see the Tutorial section and related references): Because the loop variant decreases monotonically at each loop iteration and it cannot be zero or smaller than zero, it is possible to guarantee loop termination.</p>
+<p>The macro <code class="computeroutput">CONTRACT_INIT_LOOP_VARIANT</code> must be used (once and only once) before asserting the loop variant and within the same or higher scope of the block containing <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT()</code>.</p>
+<p>Loops are code blocks that repeat themselves in iteration. Therefore, it is possible to use <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT()</code> (or <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT_MSG()</code>) to assert loop invariants together with loop variants. A loop can have multiple invariants.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="special">...</span>
+ <span class="special">{</span>
+ <span class="identifier">CONTRACT_INIT_LOOP_VARIANT</span><span class="special">;</span> <span class="comment">// Declare variant within scope.</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Loop invariants.</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">i</span> <span class="special">>=</span> <span class="number">0</span> <span class="special">)</span><span class="special">;</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="special">)</span><span class="special">;</span>
+ <span class="comment">// Loop variant (assert always positive and decreasing).</span>
+ <span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span><span class="special">(</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">i</span> <span class="special">)</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">...</span>
+</pre>
+<p>The variant expression code is used as a human readable description of the variant (see <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT_MSG()</code>).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">integer_expression</code></strong></span></td>
+<td>The integer expression which is evaluated at each loop iteration and asserted to be positive and decreasing from one iteration to the next one. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code that will automatically invoke <code class="computeroutput">contract::block_invariant_failed()</code> if the specified variant is not positive or it does not decrease.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_INIT_LOOP_VARIANT</code>, <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT_MSG()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT_MSG.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_LOOP_VARIANT_MSG.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT_LOOP_VARIANT_MSG</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="CONTRACT_ASSERT_LOOP_VARIANT.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT">
+<link rel="next" href="CONTRACT_INIT_LOOP_VARIANT.html" title="Macro CONTRACT_INIT_LOOP_VARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_LOOP_VARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_INIT_LOOP_VARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT_LOOP_VARIANT_MSG"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT_LOOP_VARIANT_MSG</span></h2>
+<p>CONTRACT_ASSERT_LOOP_VARIANT_MSG</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>CONTRACT_ASSERT_LOOP_VARIANT_MSG(integer_expression, string_description)</pre></div>
+<div class="refsect1">
+<a name="id963208"></a><h2>Description</h2>
+<p>Macro used to assert loop variant specifying also a human readable description.</p>
+<p>See <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT()</code> explanations and examples.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">integer_expression</code></strong></span></td>
+<td>The integer expression which is evaluated at each loop iteration and asserted to be positive and decreasing from one iteration to the next one. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">string_description</code></strong></span></td>
+<td>A human readable description of the loop variant expression (used for error reporting). </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code that will automatically invoke <code class="computeroutput">contract::block_invariant_failed()</code> if the specified variant is not positive or it does not decrease.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_INIT_LOOP_VARIANT()</code>, <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_LOOP_VARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_INIT_LOOP_VARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_MSG.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_ASSERT_MSG.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,74 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_ASSERT_MSG</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="CONTRACT_ASSERT.html" title="Macro CONTRACT_ASSERT">
+<link rel="next" href="contract/loop_variant_type.html" title="Type definition loop_variant_type">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/loop_variant_type.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_ASSERT_MSG"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_ASSERT_MSG</span></h2>
+<p>CONTRACT_ASSERT_MSG</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>CONTRACT_ASSERT_MSG(boolean_condition, string_description)</pre></div>
+<div class="refsect1">
+<a name="id961039"></a><h2>Description</h2>
+<p>Macro used to assert contract conditions for class invariants, preconditions, and postconditions specifying also a human readable message.</p>
+<p>When possible, it is recommended to use this macro instead of throwing <code class="computeroutput"><a class="link" href="contract/failure.html" title="Class failure">contract::failure</a></code> directly. For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_ASSERT_MSG</span><span class="special">(</span> <span class="keyword">true</span><span class="special">,</span> <span class="string">"always true"</span> <span class="special">)</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">boolean_condition</code></strong></span></td>
+<td>The boolean contract condition being asserted. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">string_description</code></strong></span></td>
+<td>A string providing a human readable description of the condition being (used for error reporting). </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following (see the Without the Macros section): </p>
+<pre class="programlisting"> <span class="keyword">if</span> <span class="special">(</span><span class="special">!</span><span class="special">(</span><span class="identifier">boolean_condition</span><span class="special">)</span><span class="special">)</span>
+ <span class="keyword">throw</span> <a class="link" href="contract/failure.html" title="Class failure">contract::failure</a><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">,</span> <span class="identifier">string_description</span><span class="special">)</span><span class="special">;</span>
+</pre>
+<p> Note how <code class="computeroutput">__FILE__</code> and <code class="computeroutput">__LINE__</code> are automatically used by the macro to improve error reporting.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT()</code>, <code class="computeroutput"><a class="link" href="contract/failure.html" title="Class failure">contract::failure</a></code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/loop_variant_type.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_BODY.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_BODY.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_BODY</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">
+<link rel="prev" href="CONTRACT_DESTRUCTOR_BODY.html" title="Macro CONTRACT_DESTRUCTOR_BODY">
+<link rel="next" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html" title="Macro CONTRACT_CONFIG_MAX_FUNCTION_ARITY">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_DESTRUCTOR_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_BODY"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_BODY</span></h2>
+<p>CONTRACT_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp</a>>
+
+</span>CONTRACT_BODY(function_name)</pre></div>
+<div class="refsect1">
+<a name="id964997"></a><h2>Description</h2>
+<p>Macro used to name the function body when separating the function definition from its declaration.</p>
+<p>This macro is used when the function is defined separately from its declaration (for example in a separate ".cpp" file) to name the body function: </p>
+<pre class="programlisting"> <span class="special">...</span> <span class="comment">// Function return type, class-type:: prefix, etc.</span>
+ <span class="identifier">CONTRACT_BODY</span><span class="special">(</span><span class="identifier">function_name</span><span class="special">)</span>
+ <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Function arguments.</span>
+ <span class="special">...</span> <span class="comment">// Function implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">function_name</code></strong></span></td>
+<td>The name of the function. For operators the name must be <code class="computeroutput">operator(</code><span class="emphasis"><em>symbol, word</em></span><code class="computeroutput">)</code> where <span class="emphasis"><em>word</em></span> must contain no special operator symbol and it must match what specified in the contract declaration (see the Tutorial section). </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="special">...</span> <span class="comment">// Function return type, class-type:: prefix, etc.</span>
+ <span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="identifier">contract_body_</span> <span class="special">##</span> <span class="identifier">function_name</span> <span class="special">##</span> <span class="identifier">_</span> <span class="comment">// Body function name.</span>
+ <span class="preprocessor">#else</span>
+ <span class="identifier">function_name</span> <span class="comment">// Function name (contracts off).</span>
+ <span class="preprocessor">#endif</span>
+ <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Function arguments.</span>
+ <span class="special">...</span> <span class="comment">// Function implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p> (The preprocessor operator <code class="computeroutput">##</code> concatenates the specified tokens.)</p>
+<p><span class="bold"><strong>See:</strong></span> Tutorial section, <code class="computeroutput">CONTRACT_FUNCTION()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_DESTRUCTOR_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_BLOCK_INVARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_BLOCK_INVARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CHECK_BLOCK_INVARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">
+<link rel="prev" href="contract/constructor.html" title="Class template constructor">
+<link rel="next" href="CONTRACT_CHECK_CLASS_INVARIANT.html" title="Macro CONTRACT_CHECK_CLASS_INVARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/constructor.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_CLASS_INVARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CHECK_BLOCK_INVARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CHECK_BLOCK_INVARIANT</span></h2>
+<p>CONTRACT_CHECK_BLOCK_INVARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp</a>>
+
+</span>CONTRACT_CHECK_BLOCK_INVARIANT</pre></div>
+<div class="refsect1">
+<a name="id967490"></a><h2>Description</h2>
+<p>Block invariants (and therefore also loop variants) are compiled and checked at run-time <span class="bold"><strong>only</strong></span> when this macro is #defined (#undefined by default).</p>
+<p>When this macro is #undefined, block invariants (and loop variants) are not compiled in the object code and no block invariant (and loop variants) contract overhead is added.</p>
+<p><span class="bold"><strong>See:</strong></span> Getting Started section for more information. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/constructor.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_CLASS_INVARIANT.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_CLASS_INVARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_CLASS_INVARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CHECK_CLASS_INVARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">
+<link rel="prev" href="CONTRACT_CHECK_BLOCK_INVARIANT.html" title="Macro CONTRACT_CHECK_BLOCK_INVARIANT">
+<link rel="next" href="CONTRACT_CHECK_PRECONDITION.html" title="Macro CONTRACT_CHECK_PRECONDITION">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_BLOCK_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_PRECONDITION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CHECK_CLASS_INVARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CHECK_CLASS_INVARIANT</span></h2>
+<p>CONTRACT_CHECK_CLASS_INVARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp</a>>
+
+</span>CONTRACT_CHECK_CLASS_INVARIANT</pre></div>
+<div class="refsect1">
+<a name="id967561"></a><h2>Description</h2>
+<p>Class invariants are compiled and checked at run-time <span class="bold"><strong>only</strong></span> when this macro is #defined (#undefined by default).</p>
+<p>When this macro is #undefined, class invariants are not compiled in the object code and no class invariant contract overhead is added.</p>
+<p><span class="bold"><strong>See:</strong></span> Getting Started section for more information. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_BLOCK_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_PRECONDITION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_POSTCONDITION.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_POSTCONDITION.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CHECK_POSTCONDITION</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">
+<link rel="prev" href="CONTRACT_CHECK_PRECONDITION.html" title="Macro CONTRACT_CHECK_PRECONDITION">
+<link rel="next" href="contract/destructor.html" title="Class template destructor">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_PRECONDITION.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/destructor.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CHECK_POSTCONDITION"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CHECK_POSTCONDITION</span></h2>
+<p>CONTRACT_CHECK_POSTCONDITION</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp</a>>
+
+</span>CONTRACT_CHECK_POSTCONDITION</pre></div>
+<div class="refsect1">
+<a name="id967700"></a><h2>Description</h2>
+<p>Postconditions are compiled and checked at run-time <span class="bold"><strong>only</strong></span> when this macro is #defined (#undefined by default).</p>
+<p>When this macro is #undefined, postconditions are not compiled in the object code and no postcondition contract overhead is added.</p>
+<p><span class="bold"><strong>See:</strong></span> Getting Started section for more information. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_PRECONDITION.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/destructor.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_PRECONDITION.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CHECK_PRECONDITION.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CHECK_PRECONDITION</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">
+<link rel="prev" href="CONTRACT_CHECK_CLASS_INVARIANT.html" title="Macro CONTRACT_CHECK_CLASS_INVARIANT">
+<link rel="next" href="CONTRACT_CHECK_POSTCONDITION.html" title="Macro CONTRACT_CHECK_POSTCONDITION">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_CLASS_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_POSTCONDITION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CHECK_PRECONDITION"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CHECK_PRECONDITION</span></h2>
+<p>CONTRACT_CHECK_PRECONDITION</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp</a>>
+
+</span>CONTRACT_CHECK_PRECONDITION</pre></div>
+<div class="refsect1">
+<a name="id967631"></a><h2>Description</h2>
+<p>Preconditions are compiled and checked at run-time <span class="bold"><strong>only</strong></span> when this macro is #defined (#undefined by default).</p>
+<p>When this macro is #undefined, preconditions are not compiled in the object code and no precondition contract overhead is added.</p>
+<p><span class="bold"><strong>See:</strong></span> Getting Started section for more information. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CHECK_CLASS_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CHECK_POSTCONDITION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CONFIG_MAX_FUNCTION_ARITY</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp>">
+<link rel="prev" href="CONTRACT_BODY.html" title="Macro CONTRACT_BODY">
+<link rel="next" href="CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html" title="Macro CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CONFIG_MAX_FUNCTION_ARITY"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CONFIG_MAX_FUNCTION_ARITY</span></h2>
+<p>CONTRACT_CONFIG_MAX_FUNCTION_ARITY</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp</a>>
+
+</span>CONTRACT_CONFIG_MAX_FUNCTION_ARITY</pre></div>
+<div class="refsect1">
+<a name="id965542"></a><h2>Description</h2>
+<p>The maximum number of function arguments supported by this library.</p>
+<p><span class="bold"><strong>Warning:</strong></span> Increasing this number can <span class="bold"><strong>significantly</strong></span> increase compilation time. If possible, do not increase this number.</p>
+<p>If you need to write a contract for a function with a number of arguments larger than the one specified by this macro default value, consider alternatives like wrapping the arguments within a <code class="computeroutput">struct</code>. For example, consider the function: </p>
+<pre class="programlisting"> <span class="comment">// Many arguments thus need to increase configuration macro value.</span>
+ <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i1</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i2</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i3</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i4</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i5</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i6</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">i7</span><span class="special">)</span><span class="special">;</span>
+</pre>
+<p> However, this function could be rewritten as a single argument function using a <code class="computeroutput">struct:</code> </p>
+<pre class="programlisting"> <span class="keyword">struct</span> <span class="identifier">ints</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">i1</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i2</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i3</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i4</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i5</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i6</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">i7</span><span class="special">;</span>
+ <span class="special">}</span><span class="special">;</span>
+
+ <span class="comment">// Just one argument and default macro value suffice. </span>
+ <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">ints</span> <span class="identifier">i</span><span class="special">)</span><span class="special">;</span>
+</pre>
+<p> Now the contract for <code class="computeroutput">f</code> only requires one argument and this macro value does not need to be increased. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp>">
+<link rel="prev" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html" title="Macro CONTRACT_CONFIG_MAX_FUNCTION_ARITY">
+<link rel="next" href="contract/constructor.html" title="Class template constructor">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/constructor.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</span></h2>
+<p>CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp</a>>
+
+</span>CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</pre></div>
+<div class="refsect1">
+<a name="id965992"></a><h2>Description</h2>
+<p>The maximum number of base classes supported when subcontracting with multiple inheritance.</p>
+<p><span class="bold"><strong>Warning:</strong></span> Increasing this number can <span class="bold"><strong>significantly</strong></span> increase compilation time. If possible, do not increase this number. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/constructor.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,101 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CONSTRUCTOR</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">
+<link rel="prev" href="CONTRACT_INVARIANT.html" title="Macro CONTRACT_INVARIANT">
+<link rel="next" href="CONTRACT_DESTRUCTOR.html" title="Macro CONTRACT_DESTRUCTOR">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_DESTRUCTOR.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CONSTRUCTOR"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CONSTRUCTOR</span></h2>
+<p>CONTRACT_CONSTRUCTOR</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp</a>>
+
+</span>CONTRACT_CONSTRUCTOR(sequence)</pre></div>
+<div class="refsect1">
+<a name="id969697"></a><h2>Description</h2>
+<p>Macro used to write contracts for constructors.</p>
+<p>This macro must be used right after the constructor declaration -- and after the member initialization list if such a list is specified. There is no need for a trailing <code class="computeroutput">";"</code> after the macro closing parenthesis <code class="computeroutput">")"</code>.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Invariants.</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">explicit</span> <span class="identifier">myvector</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">)</span> <span class="comment">// Constructor declaration.</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span> <span class="comment">// Member initialization list.</span>
+ <span class="identifier">CONTRACT_COSTRUCTOR</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert constructor preconditions.</span>
+ <span class="special">}</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert constructor postconditions.</span>
+ <span class="special">}</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Actual constructor implementation.</span>
+ <span class="special">}</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// No need for ";" after macro closing parenthesis ")".</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">sequence</code></strong></span></td>
+<td>A Boost.Preprocessor sequence of tokens <code class="computeroutput">(<span class="emphasis"><em>1st-token</em></span>)(<span class="emphasis"><em>2nd-token</em></span>)<span class="emphasis"><em>...</em></span>(<span class="emphasis"><em>last-token</em></span>)</code> that repeats the constructor signature syntactic elements and specifies the contract.<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The signature tokens are needed by the library to generate the contract code with the function name, the argument types and names, etc as discussed in the Without the Macros section (e.g., the argument names are needed to actually name the precondition and postcondition function arguments).</p></li>
+<li class="listitem"><p>The extra parenthesis <code class="computeroutput">()</code> around the tokens are mandatory (they are the ones making the preprocessor sequence).</p></li>
+<li class="listitem"><p>It is recommended to use <code class="computeroutput">CONTRACT_ASSERT()</code> to assert preconditions and postconditions within the relative code blocks.</p></li>
+<li class="listitem"><p>Within the postcondition code block, <code class="computeroutput">CONTRACT_OLDOF(</code><span class="emphasis"><em>argument-name</em></span><code class="computeroutput">)</code> is a constant reference to the related old argument value (as the value was before body execution) but only if the <span class="emphasis"><em>argument-type</em></span> was tagged <code class="computeroutput">(copyable)</code> in <code class="computeroutput">sequence</code>.</p></li>
+<li class="listitem"><p>For the body block, <code class="computeroutput">";"</code> can be used to separate the constructor definition from its declaration (see <code class="computeroutput">CONTRACT_CONSTRUCTOR_BODY()</code>).</p></li>
+<li class="listitem"><p>As explained in the Tutorial section, the tokens in <code class="computeroutput">sequence</code> appear in the exact same order as they appear in the constructor declaration followed by the optional preconditions, optional postconditions, and mandatory body.</p></li>
+<li class="listitem"><p>The constructor <code class="computeroutput">sequence</code> syntax is as follows (<span class="emphasis"><em>[]</em></span> for optional tokens, <span class="emphasis"><em>{}</em></span> tokens resulting from parenthesis contents evaluation, <span class="emphasis"><em>||</em></span> one token or the other, <span class="emphasis"><em>+</em></span> tokens repeated 1 or more times):</p></li>
+</ul></div>
+<code class="computeroutput"> <span class="emphasis"><em>[</em></span>(class)<span class="emphasis"><em>]</em></span> (<span class="emphasis"><em>class-type</em></span>) <span class="emphasis"><em>{</em></span>(public) <span class="emphasis"><em>||</em></span> (protected) <span class="emphasis"><em>||</em></span> (private)<span class="emphasis"><em>}</em></span> <span class="emphasis"><em>[</em></span>(template)( <span class="emphasis"><em>{</em></span>(<span class="emphasis"><em>function-template-parameter-type</em></span>)(<span class="emphasis"><em>function-template-parameter-name</em></span>)<span class="emphasis"><em>}+</em></span> )<span class="emphasis"><em>]</em></span> (<span class="emphasis"><em>class-name</em></span>)( <span class="emphasis"><em>{</em></span>(void) <span class="emphasis"><em>||</em></span> <span class="emphasis"><em>{[</em></span>(copyable)<span class="emphasis"><em>]</em></span>(<span class="emphasis"><em>argument-type</em></span>)(<span class="emphasis"><em>argument-name</em></
span>)<span class="emphasis"><em>}+}</em></span> ) <span class="emphasis"><em>[</em></span>(precondition) ({ ... })<span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span>(postcondition) ({ ... })<span class="emphasis"><em>]</em></span> (body) ({ ... }) </code> </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> See the Without the Macro section for examples of the code generated by this macro expansion. </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>If contract compilation is turned on, this macro expands to the constructor contract. </p></li>
+<li class="listitem"><p>Otherwise, if contract compilation is turned off, this macro expands to just the constructor function body using the given body code block (and no contract overhead is added).</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>Note:</strong></span> For functions with no argument <code class="computeroutput">(<span class="emphasis"><em>class-name</em></span>)( (void) )</code>, and not just <code class="computeroutput">(<span class="emphasis"><em>class-name</em></span>)( )</code>, must be used to specify the empty argument list within <code class="computeroutput">sequence</code>. This is because ISO standard C++ does not allow for empty macro parameters (this library also supports <code class="computeroutput">(<span class="emphasis"><em>class-name</em></span>)( )</code> but this will only compile on C99 so its use is not recommended -- see the Tutorial section for more information).</p>
+<p><span class="bold"><strong>Note:</strong></span> In comparing the <code class="computeroutput">sequence</code> syntax of constructors with the one of member functions from <code class="computeroutput">CONTRACT_FUNCTION()</code>, note the following differences (see also the Constructor Call Semantics in the Tutorial section): There is no <code class="computeroutput">(copyable)</code> before <span class="emphasis"><em>class-type</em></span> because there is no object before construction body execution; There is no <code class="computeroutput">(inherit)</code> because constructors cannot directly subcontract; There is no <code class="computeroutput">(static)</code> or <code class="computeroutput">(virtual)</code> because constructors cannot be static or virtual; There is no <code class="computeroutput">(<span class="emphasis"><em>result-type</em></span>)</code> because constructors have no return value; The <span class="emphasis"><em>function-name</em></span> must be the <span class="emphasis"><em>class-nam
e</em></span> as always for constructors; There is no trailing <code class="computeroutput">(const)</code> because constructor cannot be constant members.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT()</code>, <code class="computeroutput">CONTRACT_INVARIANT()</code>, <code class="computeroutput">CONTRACT_DESTRUCTOR()</code>, <code class="computeroutput">CONTRACT_FUNCTION()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_INVARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_DESTRUCTOR.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR_BODY.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_CONSTRUCTOR_BODY.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,140 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_CONSTRUCTOR_BODY</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">
+<link rel="prev" href="CONTRACT_INIT_LOOP_VARIANT.html" title="Macro CONTRACT_INIT_LOOP_VARIANT">
+<link rel="next" href="CONTRACT_DESTRUCTOR_BODY.html" title="Macro CONTRACT_DESTRUCTOR_BODY">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_INIT_LOOP_VARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_DESTRUCTOR_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_CONSTRUCTOR_BODY"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_CONSTRUCTOR_BODY</span></h2>
+<p>CONTRACT_CONSTRUCTOR_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp</a>>
+
+</span>CONTRACT_CONSTRUCTOR_BODY(class_type, class_name)</pre></div>
+<div class="refsect1">
+<a name="id963741"></a><h2>Description</h2>
+<p>Macro used to name the constructor body when separating constructor definition from its declaration.</p>
+<p>This macro is used when the constructor is defined outside the class declaration (for example in a separate ".cpp" file) to name the constructor body function: </p>
+<pre class="programlisting"> <span class="identifier">BOOST_CONTRACT_CONSTRUCTOR_BODY</span><span class="special">(</span><span class="identifier">class_type</span><span class="special">,</span> <span class="identifier">class_name</span><span class="special">)</span>
+ <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Constructor arguments.</span>
+ <span class="special">...</span> <span class="comment">// Constructor implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">class_type</code></strong></span></td>
+<td>The type of the class. For class templates this must also list the template parameters. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">class_name</code></strong></span></td>
+<td>The constructor name which is the class type name. For class templates this shall not list the template parameters. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">class_type</span><span class="special">::</span><span class="identifier">contract_body_constructor_</span> <span class="comment">// Constructor body function name.</span>
+ <span class="preprocessor">#else</span>
+ <span class="identifier">class_type</span><span class="special">::</span><span class="identifier">class_name</span> <span class="comment">// Constructor function (contracts off).</span>
+ <span class="preprocessor">#endif</span>
+ <span class="special">(</span><span class="special">...</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Constructor arguments.</span>
+ <span class="special">...</span> <span class="comment">// Constructor implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>Member Initialization List</strong></span></p>
+<p>A limitation of this mechanism is that it does not directly support constructor member initialization list. If a member initialization list is specified then the constructor definition must be provided together with its declaration (for example in the header file). (This library could overcome this limitation in the future if upcoming C++ standard revisions were to support delegating constructors.)</p>
+<p>If the constructor implementation must be separated from its declaration, a possible workaround is to:</p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem"><p>Delegate the construction job to a special initialization function which must be named "constructor" (and it should be private to avoid other code from messing with the object construction).</p></li>
+<li class="listitem"><p>Program the real constructor to just invoke the initialization function.</p></li>
+<li class="listitem"><p>Write the contract for the initialization function instead that for the real constructor (but using CONTRACT_CONSTRUCTOR() instead of CONTRACT_FUNCTION()).</p></li>
+</ol></div>
+<p>
+</p>
+<p>If this is done then both the constructor and the initialization function body definitions can be separated from the contract declaration. For example: </p>
+<pre class="programlisting"> <span class="comment">// Declaration.</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Invariants.</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span><span class="special">::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">myvector</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">)</span><span class="special">;</span> <span class="comment">// Separated definition.</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// The initialization function is private and must be named "constructor</span>
+<span class="string">".
+ void constructor(size_type count)
+ // Specify the contract for the initialization function instead of the real constructor.
+ CONTRACT_CONSTRUCTOR( (class) (myvector)
+ (private) (myvector)( (size_type)(count) ), {
+ // Constructor preconditions (none in this case).
+ }, {
+ // Constructor postconditions.
+ CONTRACT_ASSERT(self.now.size() == count.now,
+ "</span><span class="identifier">size</span> <span class="identifier">set</span> <span class="identifier">to</span> <span class="identifier">count</span><span class="string">");
+ }, ;) // Now we can separate the body definition using "</span><span class="special">;</span><span class="string">".
+
+ std::vector<T> vector_;
+ };
+
+ // Separated definition (possibly in a different file).
+
+ template<typename T>
+ myvector<T>::myvector(size_type count):
+ vector_(count) { // Member initialization list.
+ constructor(count); // Just invoke the initialization function.
+ }
+
+ template<typename T>
+ void myvector<T>::CONTRACT_BODY(constructor)(size_type count) {
+ // Actual constructor implementation (do nothing in this case).
+ }
+</span></pre>
+<p>To allow for this workaround, the <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code> macro can follow a member function but <span class="bold"><strong>only</strong></span> when the member function is named "constructor", it has a <code class="computeroutput">void</code> return type, and it is not <code class="computeroutput">const</code> (essentially, only when its signature matches the one of a constructor). Be aware that for this special "constructor" member function, class invariants will <span class="bold"><strong>not</strong></span> be checked before body execution (because the <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code> macro implements the Constructor Call Semantics and not the Member Function Call Semantics as explained in the Tutorial section).</p>
+<p><span class="bold"><strong>See:</strong></span> Tutorial section, <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_INIT_LOOP_VARIANT.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_DESTRUCTOR_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,93 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_DESTRUCTOR</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">
+<link rel="prev" href="CONTRACT_CONSTRUCTOR.html" title="Macro CONTRACT_CONSTRUCTOR">
+<link rel="next" href="CONTRACT_FUNCTION.html" title="Macro CONTRACT_FUNCTION">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONSTRUCTOR.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_FUNCTION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_DESTRUCTOR"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_DESTRUCTOR</span></h2>
+<p>CONTRACT_DESTRUCTOR</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp</a>>
+
+</span>CONTRACT_DESTRUCTOR(sequence)</pre></div>
+<div class="refsect1">
+<a name="id970709"></a><h2>Description</h2>
+<p>Macro used to write contracts for destructors.</p>
+<p>This macro must be used right after the destructor declaration. There is no need for a trailing <code class="computeroutput">";"</code> after the macro closing parenthesis <code class="computeroutput">")"</code>.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Invariants.</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">myvector</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="comment">// Destructor declaration.</span>
+ <span class="identifier">BOOST_CONTRACT_DESTRUCTOR</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+ <span class="comment">// Never preconditions or postconditions for destructors.</span>
+ <span class="special">(</span><span class="identifier">body</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Actual destructor implementation.</span>
+ <span class="special">}</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// No need for ";" after macro closing parenthesis ")".</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">signature_sequence</code></strong></span></td>
+<td>A Boost.Preprocessor sequence of tokens <code class="computeroutput">(<span class="emphasis"><em>1st-token</em></span>)(<span class="emphasis"><em>2nd-token</em></span>)<span class="emphasis"><em>...</em></span>(<span class="emphasis"><em>last-token</em></span>)</code> that repeats the destructor signature syntactic elements.<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The signature tokens are needed by the library to generate the contract code with the function name, the argument types and names, etc as discussed in the Without the Macros section.</p></li>
+<li class="listitem"><p>The extra parenthesis <code class="computeroutput">()</code> around the tokens are mandatory (they are the ones making the preprocessor sequence).</p></li>
+<li class="listitem"><p>For the body code block, <code class="computeroutput">";"</code> can be specified to separate the destructor definition from its declaration (see <code class="computeroutput">CONTRACT_DESTRUCTOR_BODY()</code>).</p></li>
+<li class="listitem"><p>As explained in the Tutorial section, the tokens in <code class="computeroutput">sequence</code> appear in the exact same order as they appear in the destructor declaration followed by the mandatory body code block.</p></li>
+<li class="listitem"><p>The destructor <code class="computeroutput">sequence</code> syntax is as follows (<span class="emphasis"><em>[]</em></span> for optional tokens, <span class="emphasis"><em>{}</em></span> tokens resulting from parenthesis contents evaluation, <span class="emphasis"><em>||</em></span> one token or the other):</p></li>
+</ul></div>
+<code class="computeroutput"> <span class="emphasis"><em>[</em></span>(template)<span class="emphasis"><em>]</em></span> (<span class="emphasis"><em>class-type</em></span>) <span class="emphasis"><em>{</em></span>(public) <span class="emphasis"><em>||</em></span> (protected) <span class="emphasis"><em>||</em></span> (private)<span class="emphasis"><em>}</em></span> [(virtual)] (<span class="emphasis"><em>class-name</em></span>)( (void) ) (body) ({ ... }) </code> </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> See the Without the Macro section for examples of the code generated by this macro expansion. </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>If contract compilation is turned on, this macro expands to the destructor contract. </p></li>
+<li class="listitem"><p>Otherwise, if contract compilation is turned off, this macro expands to just the destructor function body using body code block (and no contract overhead is added).</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>Note:</strong></span> Destructor have no argument so <code class="computeroutput">(void)</code> must always be used in <code class="computeroutput">(<span class="emphasis"><em>class-name</em></span>)( (void) )</code> to specify the empty argument list within <code class="computeroutput">sequence</code>. This is because ISO standard C++ does not allow for empty macro parameters (this library also supports <code class="computeroutput">(<span class="emphasis"><em>class-name</em></span>)( )</code> but this will only compile on C99 so its use is not recommended -- see the Tutorial section for more information).</p>
+<p><span class="bold"><strong>Note:</strong></span> In comparing the <code class="computeroutput">sequence</code> syntax of destructors with the one of member functions from <code class="computeroutput">CONTRACT_FUNCTION()</code>, note the following differences (see also the Destructor Call Semantics in the Tutorial section): There is no <code class="computeroutput">(copyable)</code> before <span class="emphasis"><em>class-type</em></span> because there are no postconditions; There is no <code class="computeroutput">(inherit)</code> because destructors cannot directly subcontract; There is no function template keyword and arguments because destructors cannot be template functions; There is no <code class="computeroutput">(static)</code> because destructors cannot be static; There is no <code class="computeroutput">(<span class="emphasis"><em>result-type</em></span>)</code> because destructors have no return value; The <span class="emphasis"><em>function-name</em></span> must be the <span class="emphasis"><e
m>class-name</em></span> as always for destructors; The function argument list must be <code class="computeroutput">(void)</code> because destructors take no argument; There is no trailing <code class="computeroutput">(const)</code> because constructor cannot be constant members.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT()</code>, <code class="computeroutput">CONTRACT_INVARIANT()</code>, <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code>, <code class="computeroutput">CONTRACT_FUNCTION()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONSTRUCTOR.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_FUNCTION.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR_BODY.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_DESTRUCTOR_BODY.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,84 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_DESTRUCTOR_BODY</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">
+<link rel="prev" href="CONTRACT_CONSTRUCTOR_BODY.html" title="Macro CONTRACT_CONSTRUCTOR_BODY">
+<link rel="next" href="CONTRACT_BODY.html" title="Macro CONTRACT_BODY">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONSTRUCTOR_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_DESTRUCTOR_BODY"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_DESTRUCTOR_BODY</span></h2>
+<p>CONTRACT_DESTRUCTOR_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp</a>>
+
+</span>CONTRACT_DESTRUCTOR_BODY(class_type, class_name)</pre></div>
+<div class="refsect1">
+<a name="id964594"></a><h2>Description</h2>
+<p>Macro used to name the destructor body when separating destructor definition from its declaration.</p>
+<p>This macro is used when the destructor is defined outside the class declaration (for example in a separate ".cpp" file) to name the destructor body function: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_DESTRUCTOR_BODY</span><span class="special">(</span><span class="identifier">class_type</span><span class="special">,</span> <span class="identifier">class_name</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Destructors have no argument.</span>
+ <span class="special">...</span> <span class="comment">// Destructor implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">class_type</code></strong></span></td>
+<td>The type of the class. For class templates this must also list the template parameters. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">class_name</code></strong></span></td>
+<td>The constructor name which is the class type name -- do <span class="bold"><strong>not</strong></span> prefixed the class name with "~" (this is the class name and not the destructor name). For class templates this shall not list the template parameters. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">class_type</span><span class="special">::</span><span class="identifier">contract_body_destructor_</span> <span class="comment">// Destructor body function name.</span>
+ <span class="preprocessor">#else</span>
+ <span class="identifier">class_type</span><span class="special">::</span><span class="special">~</span><span class="identifier">class_name</span> <span class="comment">// Destructor function (contracts off).</span>
+ <span class="preprocessor">#endif</span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Destructor have no argument.</span>
+ <span class="special">...</span> <span class="comment">// Destructor implementation.</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>See:</strong></span> Tutorial section, <code class="computeroutput">CONTRACT_DESTRUCTOR()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_CONSTRUCTOR_BODY.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_FUNCTION.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_FUNCTION.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,104 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_FUNCTION</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">
+<link rel="prev" href="CONTRACT_DESTRUCTOR.html" title="Macro CONTRACT_DESTRUCTOR">
+<link rel="next" href="contract/nonmember_function.html" title="Class template nonmember_function">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_DESTRUCTOR.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/nonmember_function.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_FUNCTION"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_FUNCTION</span></h2>
+<p>CONTRACT_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp</a>>
+
+</span>CONTRACT_FUNCTION(sequence)</pre></div>
+<div class="refsect1">
+<a name="id971466"></a><h2>Description</h2>
+<p>Macro used to write contracts for functions (non-static members, static members, and non-members but not for constructors and destructors).</p>
+<p>This macro must be used right after the member function declaration. There is no need for a trailing <code class="computeroutput">";"</code> after the macro closing parenthesis <code class="computeroutput">")"</code>.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Invariants.</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="comment">// Function declaration.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span><span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span><span class="special">)</span><span class="special">(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert function preconditions.</span>
+ <span class="special">}</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert function postconditions.</span>
+ <span class="special">}</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Actual function implementation.</span>
+ <span class="special">}</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// No need for ";" after macro closing parenthesis ")".</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">sequence</code></strong></span></td>
+<td>A Boost.Preprocessor sequence of tokens <code class="computeroutput">(<span class="emphasis"><em>1st-token</em></span>)(<span class="emphasis"><em>2nd-token</em></span>)<span class="emphasis"><em>...</em></span>(<span class="emphasis"><em>last-token</em></span>)</code> that repeats the function signature syntactic elements and specifies the contract.<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The signature tokens are needed by the library to generate the contract code with the function name, the argument types and names, etc as explained in the the Without the Macros section (e.g., the argument names are needed to actually name the arguments for the precondition and postcondition functions).</p></li>
+<li class="listitem"><p>The extra parenthesis <code class="computeroutput">()</code> around the tokens are mandatory (they are the ones making the preprocessor sequence).</p></li>
+<li class="listitem"><p>It is recommended to use <code class="computeroutput">CONTRACT_ASSERT()</code> to assert preconditions and postconditions within the relative code blocks.</p></li>
+<li class="listitem"><p>Within the postcondition code block, <code class="computeroutput">CONTRACT_OLDOF(this)</code> is a constant pointer to the object old value (as it was before body execution) but only if <span class="emphasis"><em>class-type</em></span> was tagged <code class="computeroutput">(copyable)</code> in <code class="computeroutput">sequence</code>. Similarly, <code class="computeroutput">CONTRACT_OLDOF(</code><span class="emphasis"><em>argument-name</em></span><code class="computeroutput">)</code> is a constant reference to the related old argument value (as is was before body execution) but only if the <span class="emphasis"><em>argument-type</em></span> was tagged <code class="computeroutput">(copyable)</code> in <code class="computeroutput">sequence</code>.</p></li>
+<li class="listitem"><p>Within the postcondition code block, <span class="emphasis"><em>result-name</em></span> (with the actual name specified in <code class="computeroutput">sequence</code>) is a constant reference to the value being returned but only when <span class="emphasis"><em>result-type</em></span> is specified different from <code class="computeroutput">void</code> in <code class="computeroutput">sequence</code>.</p></li>
+<li class="listitem"><p>For the body block, <code class="computeroutput">";"</code> can be used to separate the constructor definition from its declaration (see <code class="computeroutput">CONTRACT_CONSTRUCTOR_BODY()</code>). Also, <code class="computeroutput">"= 0;"</code> can be specified when writing contracts for pure virtual member functions.</p></li>
+<li class="listitem"><p>As explained in the Tutorial section, the tokens in <code class="computeroutput">sequence</code> appear in the exact same order as they appear in the member function declaration followed by the optional preconditions, optional postconditions, and mandatory body.</p></li>
+<li class="listitem"><p>The function <code class="computeroutput">sequence</code> syntax is as follows (<span class="emphasis"><em>[]</em></span> for optional tokens, <span class="emphasis"><em>{}</em></span> tokens resulting from parenthesis contents evaluation, <span class="emphasis"><em>||</em></span> one token or the other, <span class="emphasis"><em>*</em></span> tokens repeated 0 or more times, <span class="emphasis"><em>+</em></span> tokens repeated 1 or more times, <span class="emphasis"><em>{}::</em></span> tokens specified only for member functions, <span class="emphasis"><em>{}?</em></span> tokens specified only for non-void functions):</p></li>
+</ul></div>
+<code class="computeroutput"> <span class="emphasis"><em>{[</em></span>(template)<span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span>(copyable)<span class="emphasis"><em>]</em></span>(<span class="emphasis"><em>class-type</em></span>) <span class="emphasis"><em>{</em></span>(inherit)(<span class="emphasis"><em>base-class-type</em></span>)<span class="emphasis"><em>}*</em></span> <span class="emphasis"><em>{</em></span>(public) <span class="emphasis"><em>||</em></span> (protected) <span class="emphasis"><em>||</em></span> (private)<span class="emphasis"><em>}}::</em></span> <span class="emphasis"><em>[</em></span>(template)( <span class="emphasis"><em>{</em></span>(<span class="emphasis"><em>function-template-parameter-type</em></span>)(<span class="emphasis"><em>function-template-parameter-name</em></span>)<span class="emphasis"><em>}+</em></span> )<span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[{</em></span>(static) <span class="emphasis"><em>||</em></span>
(virtual)<span class="emphasis"><em>}]</em></span> (<span class="emphasis"><em>result-type</em></span>) (<span class="emphasis"><em>function-name</em></span>)( <span class="emphasis"><em>{</em></span>(void) <span class="emphasis"><em>||</em></span> <span class="emphasis"><em>{[</em></span>(copyable)<span class="emphasis"><em>]</em></span>(<span class="emphasis"><em>argument-type</em></span>)(<span class="emphasis"><em>argument-name</em></span>)<span class="emphasis"><em>}+}</em></span> ) <span class="emphasis"><em>[</em></span>(const)<span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span>(precondition) ({ ... })<span class="emphasis"><em>]</em></span> <span class="emphasis"><em>[</em></span>(postcondition) {(<span class="emphasis"><em>result-name</em></span>)}? ({ ... })<span class="emphasis"><em>]</em></span> (body) ({ ... }) </code> </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> See Without the Macro section for examples of the code generated by this macro expansion. </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>If contract compilation is turned on, this macro expands to the function contract (see the Without the Macros section). </p></li>
+<li class="listitem"><p>Otherwise, if contract compilation is turned off, this macro expands to just the function body using <code class="computeroutput">body_code_block</code> (and no contract overhead is added).</p></li>
+</ul></div>
+<p>
+The usual C++ restrictions on the function signature apply. For example, static member functions cannot be <code class="computeroutput">virtual</code> or <code class="computeroutput">const</code>, plus they cannot subcontract so <code class="computeroutput">(inherit)</code> cannot be specified. The library will generate compile-time errors if <code class="computeroutput">sequence</code> violates these constraints.</p>
+<p>For <span class="bold"><strong>operators</strong></span>, the operator name must also be spelled out in words and passed as <code class="computeroutput">(operator(<span class="emphasis"><em>symbol, word</em></span>))</code> (this is because operator names usually contain symbols, like <code class="computeroutput">"[]"</code>, that are not valid preprocessor token so they cannot be used by this library). The spelled out operator name is arbitrary but it cannot contain operator special symbols (see the Tutorial for more information). For example, for <code class="computeroutput">operator[]</code> the function name passed to <code class="computeroutput">sequence</code> could be <code class="computeroutput">(operator([], at))</code>.</p>
+<p><span class="bold"><strong>Overloaded</strong></span> functions, with same number of arguments and constant qualifier, must have different argument names (and not just different argument types). This is necessary otherwise this library will not be able to distinguish the contract of the overloaded functions from each other and it will generate a compile-time error. (C++ uses the argument types and not their names to distinguish overloaded functions from each other but this library cannot use the argument types because, in general, they are not valid preprocessor tokens -- see the Tutorial for more information on this topic.)</p>
+<p><span class="bold"><strong>Note:</strong></span> For functions with no argument <code class="computeroutput">(<span class="emphasis"><em>function-name</em></span>)( (void) )</code>, and not just <code class="computeroutput">(<span class="emphasis"><em>function-name</em></span>)( )</code>, must be used to specify the empty argument list within <code class="computeroutput">sequence</code>. This is because ISO standard C++ does not allow for empty macro parameters (this library also supports <code class="computeroutput">(<span class="emphasis"><em>function-name</em></span>)( )</code> but this will only compile on C99 so its use is not recommended -- see the Tutorial section for more information).</p>
+<p><span class="bold"><strong>Warning:</strong></span> While there is only a limited amount of compile-time error checking that the library can do on <code class="computeroutput">sequence</code>, the current library implementation does not uses the best possible error detection and reporting mechanism for missuses of the <code class="computeroutput">sequence</code> syntax. In some cases, and depending on the compiler used, an error in programming <code class="computeroutput">sequence</code> might result in cryptic compiler errors (involving library internal templates and preprocessor macros, Boost.Preprocessor internal macros <code class="computeroutput">BOOST_PP_...</code>, and only referring to the contract macro first line number). The best way to resolve these errors is usually to inspect the <code class="computeroutput">sequence</code> by eye instead of trying to make sense of the compiler error messages. Also, try first to compile with contracts turned off so to make sure that the errors are actually
in the contract code. Rarely, it might be useful to look at the code generated by the contract macro expansion after preprocessing using your compiler related options ("-E -P" on GCC, "\EP" on Microsoft Visual C++, etc).</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT()</code>, <code class="computeroutput">CONTRACT_INVARIANT()</code>, <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code>, <code class="computeroutput">CONTRACT_DESTRUCTOR()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_DESTRUCTOR.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/nonmember_function.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_INIT_LOOP_VARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_INIT_LOOP_VARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,58 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_INIT_LOOP_VARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT_MSG">
+<link rel="next" href="CONTRACT_CONSTRUCTOR_BODY.html" title="Macro CONTRACT_CONSTRUCTOR_BODY">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONSTRUCTOR_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_INIT_LOOP_VARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_INIT_LOOP_VARIANT</span></h2>
+<p>CONTRACT_INIT_LOOP_VARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>CONTRACT_INIT_LOOP_VARIANT</pre></div>
+<div class="refsect1">
+<a name="id963357"></a><h2>Description</h2>
+<p>Initialize the evaluation of the loop variant expression of type <code class="computeroutput">contract::loop_variant_type</code>.</p>
+<p>It must be used once, and only once, in a given code block. It must be used before using <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT()</code> (or <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT_MSG()</code>) at same of higher scope level.</p>
+<p>It can also be used within a <code class="computeroutput">for</code> loop initialization argument, for example: </p>
+<pre class="programlisting"> <span class="keyword">void</span> <span class="identifier">offset</span><span class="special">(</span><span class="keyword">int</span><span class="special">&</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">CONTRACT_INIT_LOOP_VARIANT</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">MAX</span><span class="special">;</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span><span class="special">(</span> <span class="identifier">MAX</span> <span class="special">-</span> <span class="identifier">i</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">...</span>
+ <span class="identifier">i</span> <span class="special">+=</span> <span class="identifier">DELTA</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+</pre>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">contract::loop_variant_type</code>, <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT()</code>, <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT_MSG()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONSTRUCTOR_BODY.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_INVARIANT.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_INVARIANT.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,96 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_INVARIANT</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">
+<link rel="prev" href="contract/from.html" title="Type from">
+<link rel="next" href="CONTRACT_CONSTRUCTOR.html" title="Macro CONTRACT_CONSTRUCTOR">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/from.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONSTRUCTOR.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_INVARIANT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_INVARIANT</span></h2>
+<p>CONTRACT_INVARIANT</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp</a>>
+
+</span>CONTRACT_INVARIANT(sequence)</pre></div>
+<div class="refsect1">
+<a name="id969100"></a><h2>Description</h2>
+<p>Macro used to write (static and non) class invariants.</p>
+<p>This macro should be used in a private section in the class declaration. There is no need for a trailing <code class="computeroutput">";"</code> after the macro closing parenthesis <code class="computeroutput">")"</code>.</p>
+<p>For example (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+
+ <span class="identifier">CONTRACT_INVARIANT</span><span class="special">(</span> <span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert static class invariants.</span>
+ <span class="special">}</span><span class="special">)</span> <span class="special">(</span><span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert non-static class invariants.</span>
+ <span class="special">}</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// No need for ";" after macro closing parenthesis ")".</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">sequence</code></strong></span></td>
+<td>A Boost.Preprocesor sequence of tokens <code class="computeroutput">(<span class="emphasis"><em>1st-token</em></span>)(<span class="emphasis"><em>2nd-token</em></span>)<span class="emphasis"><em>...</em></span>(<span class="emphasis"><em>last-token</em></span>)</code> that specifies static and non-static class invariants.<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>At least one of the class invariants must be specified (i.e., you can specify only non-static class invariants, only static class invariants, or both static and non-static class invariants).</p></li>
+<li class="listitem"><p>The code block <code class="computeroutput">({ ... })</code> following <code class="computeroutput">(static)</code> should assert static class invariants. The other code block should assert non-static class invariants.</p></li>
+<li class="listitem"><p>The class invariant <code class="computeroutput">sequence</code> syntax is as follows (<span class="emphasis"><em>[]</em></span> for optional tokens):</p></li>
+</ul></div>
+<code class="computeroutput"> <span class="emphasis"><em>[</em></span>(static)({ ... })<span class="emphasis"><em>] </em></span>({ ... }) </code> </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> See the Without the Macro section for examples of the code generated by this macro expansion. </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>If contract compilation is turned on, this macro expands to the augmented state member variable named <code class="computeroutput">contract_state_</code>. </p></li>
+<li class="listitem"><p>Furthermore, if invariants compilation is specifically turned on, this macro expands to the static member function <code class="computeroutput">contract_static_invariant_</code> and the non-static member function <code class="computeroutput">contract_invariant_</code> defined respectively using the two code blocks from <code class="computeroutput">(static)({ ... })</code> and <code class="computeroutput">({ ... })</code>. </p></li>
+<li class="listitem"><p>Otherwise, if contract compilation is turned off, this macro expands to nothing (and no contract overhead is added).</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>Note:</strong></span> Even if a class has no invariants, you must still use this macro (with an empty code block) otherwise the library will generate a compile-time error saying that it cannot find the invariant check function for your class (see the Tutorial section for more information): </p>
+<pre class="programlisting"> <span class="keyword">class</span> <span class="identifier">myclass</span> <span class="special">{</span>
+
+ <span class="comment">// Assert no invariant (mandatory).</span>
+ <span class="identifier">CONTRACT_INVARIANT</span><span class="special">(</span> <span class="special">(</span><span class="special">{</span><span class="special">}</span><span class="special">)</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p> In this case, <code class="computeroutput">CONTRACT_INVARIANT()</code> cannot be used instead of <code class="computeroutput">CONTRACT_INVARIANT( ({}) )</code>. This is because ISO standard C++ does not allow for empty macro parameters (this library also supports <code class="computeroutput">CONTRACT_INVARIANT()</code> but this will only compile on C99 so its use is not recommended -- see the Tutorial section for more information).</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_ASSERT()</code>, <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code>, <code class="computeroutput">CONTRACT_DESTRUCTOR()</code>, <code class="computeroutput">CONTRACT_FUNCTION()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/from.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="CONTRACT_CONSTRUCTOR.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_OLDOF.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_OLDOF.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,71 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_OLDOF</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">
+<link rel="prev" href="contract/copy.html" title="Class template copy">
+<link rel="next" href="contract/state.html" title="Class state">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/copy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/state.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_OLDOF"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_OLDOF</span></h2>
+<p>CONTRACT_OLDOF</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp</a>>
+
+</span>CONTRACT_OLDOF(variable_name)</pre></div>
+<div class="refsect1">
+<a name="id978321"></a><h2>Description</h2>
+<p>Macro used to access old value for the variable with the specified name in postconditions.</p>
+<p>The library automatically declares variables to hold old values of types tagged <code class="computeroutput"><a class="link" href="contract/copyable.html" title="Class template copyable">contract::copyable</a></code> and makes then accessible in the postconditions code block (and from the postconditions code block only). This macro simply expands the specified name to the name of the old variable automatically declared by the library.</p>
+<p>For example, in postconditions of a member function <code class="computeroutput">void myvector<T>::push_back(const T& element)</code>, if both the class type <code class="computeroutput">myvector</code> and the <code class="computeroutput">element</code> argument type <code class="computeroutput">const T&</code> have been tagged copyable (see the <code class="computeroutput">sequence</code> parameter of <code class="computeroutput">CONTRACT_FUNCTION()</code> and <code class="computeroutput"><a class="link" href="contract/copy.html" title="Class template copy">contract::copy</a></code>) then the following old values are available: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span><span class="special">-></span><span class="special">...</span> <span class="comment">// Object old value.</span>
+ <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">element</span><span class="special">)</span><span class="special">...</span> <span class="comment">// Old value of function argument `element`.</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">variable_name</code></strong></span></td>
+<td>Use <code class="computeroutput">this</code> to access a pointer to the old object value. Use one of the function argument names to access the old value of that argument. The type of the variable with the specified name must be tagged <code class="computeroutput"><a class="link" href="contract/copyable.html" title="Class template copyable">contract::copyable</a></code> in the signature sequence its old value to be available (otherwise the use of this macro will generate a compile-time error with <code class="computeroutput">noold</code> in the error message). </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> This macro expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="identifier">contract_old_</span> <span class="special">##</span> <span class="identifier">variable_name</span> <span class="special">##</span> <span class="identifier">_</span>
+</pre>
+<p> (The preprocessor operator <code class="computeroutput">##</code> concatenates the specified tokens.)</p>
+<p><span class="bold"><strong>Note:</strong></span> Shallow copies are performed for old values of pointer types (unless the pointed type defines a different copy constructor or <code class="computeroutput"><a class="link" href="contract/copy.html" title="Class template copy">contract::copy</a></code> has been specialized for the pointed type to perform a different copy operation). Therefore, if a pointer type is tagged <code class="computeroutput"><a class="link" href="contract/copyable.html" title="Class template copyable">contract::copyable</a></code>, the old pointer value will be available in the postconditions and not the old pointed value -- this might not be what you intended. The notable exception is the object which is passed by pointer (like <code class="computeroutput">this</code>) but its old value is automatically deep copied by the library.</p>
+<p><span class="bold"><strong>Note:</strong></span> The library supports old values for the object and all the function argument types. This is a subset of the old values supported by Eiffel which are old values for any expression that can be evaluated in postconditions. However, the old values supported by the library are usually enough to program the postconditions.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="contract/copy.html" title="Class template copy">contract::copy</a></code>, <code class="computeroutput"><a class="link" href="contract/copyable.html" title="Class template copyable">contract::copyable</a></code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/copy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/state.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/CONTRACT_WRAP_TYPE.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/CONTRACT_WRAP_TYPE.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,97 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro CONTRACT_WRAP_TYPE</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="contract/wrap_void_T__id437104.html" title="Struct template wrap<void(T)>">
+<link rel="next" href="contract__/Rationale.html" title="Annex: Rationale">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/wrap_void_T__id437104.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract__/Rationale.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="CONTRACT_WRAP_TYPE"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro CONTRACT_WRAP_TYPE</span></h2>
+<p>CONTRACT_WRAP_TYPE</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span>CONTRACT_WRAP_TYPE(parenthesized_type)</pre></div>
+<div class="refsect1">
+<a name="id980750"></a><h2>Description</h2>
+<p>Macro used to pass type expressions with unwrapped commas as macro parameters.</p>
+<p>The C++ ISO standard preprocessor only recognizes the parenthesis <code class="computeroutput"></code>() and it does not recognize any other parenthesis like <code class="computeroutput"><></code>, <code class="computeroutput">{}</code>, <code class="computeroutput"></code>[], etc.</p>
+<p>As a consequence, any comma within a macro parameter which is not wrapped by the <code class="computeroutput"></code>() parenthesis will be interpreted by the preprocessor as a separation token (the end of the current macro parameter and the start of the next macro parameter). See also the Tutorial section for more explanation and examples.</p>
+<p><span class="bold"><strong>Value Expressions</strong></span></p>
+<p>Value expressions passed as macro parameters and containing unwrapped commas can be wrapped by and extra set of parenthesis <code class="computeroutput"></code>().</p>
+<p>For example, this is OK because the comma `<code class="computeroutput">,</code>` is already wrapped by the parenthesis <code class="computeroutput"></code>() of the <code class="computeroutput">add()</code> function call: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">add</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special">==</span> <span class="number">3</span> <span class="special">)</span><span class="special">;</span> <span class="comment">// OK.</span>
+</pre>
+<p> This is incorrect instead because the comma `<code class="computeroutput">,</code>` is not wrapped. It is interpreted as a call to <code class="computeroutput">CONTRACT_ASSERT()</code> passing <span class="bold"><strong>two</strong></span> distinct macro parameters `<code class="computeroutput">std::map<double</code>` and `<code class="computeroutput">int>().empty()</code>` separated by the comma `<code class="computeroutput">,</code>`: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span><span class="special">(</span><span class="special">)</span><span class="special">.</span><span class="identifier">empty</span><span class="special">(</span><span class="special">)</span> <span class="special">)</span><span class="special">;</span> <span class="comment">// Error.</span>
+</pre>
+<p> However, it can be fixed by using and extra set of parenthesis to wrap the value expression: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span><span class="special">(</span><span class="special">)</span><span class="special">.</span><span class="identifier">empty</span><span class="special">(</span><span class="special">)</span><span class="special">)</span> <span class="special">)</span><span class="special">;</span> <span class="comment">// OK.</span>
+</pre>
+<p><span class="bold"><strong>Type Expressions</strong></span></p>
+<p>A similar issue arises when type expressions with unwrapped commas are passed as macro parameters (including when they are passed as preprocessor sequence elements): </p>
+<pre class="programlisting"> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">dobule</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="identifier">m</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span><span class="special">)</span> <span class="special">(</span><span class="identifier">m</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// Error.</span>
+ <span class="special">...</span>
+ <span class="special">)</span>
+</pre>
+<p> This is interpreted as a preprocessor 2-tuple with two elements `<code class="computeroutput">std::map<double</code>` and `<code class="computeroutput">int></code>` separated by the comma `<code class="computeroutput">,</code>` instead that one single element of the preprocessor sequence.</p>
+<p><span class="bold"><strong>Note:</strong></span> Unfortunately, the approach followed for value expressions cannot be used for macro parameters that represent type expressions. That is because types wrapped by an extra set of parenthesis <code class="computeroutput"></code>() can introduce syntax or semantics errors depending on the context where they are used. For example, with respect to <code class="computeroutput">std::map<double, int></code>, the wrapped type expression <code class="computeroutput">(std::map<double, int>)</code> could be compiled a C-style type cast potentically introducing a semantic error, or it could generate a syntax error if it were used to declare a variable.</p>
+<p>The macro <code class="computeroutput">CONTRACT_WRAP_TYPE()</code> (or equivalently the <code class="computeroutput"><a class="link" href="contract/wrap.html" title="Struct template wrap">contract::wrap</a></code> class template) is be used to overcome this limitation: </p>
+<pre class="programlisting"> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">dobule</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="identifier">m</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="identifier">CONTRACT_WRAP_TYPE</span><span class="special">(</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span><span class="special">)</span> <span class="special">)</span><span class="special">)</span> <span class="comment">//OK.</span>
+ <span class="special">(</span><span class="identifier">m</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">...</span>
+ <span class="special">)</span>
+</pre>
+<p> Note that the extra pair of parenthesis <code class="computeroutput"></code>() used in invoking the macro are mandatory as they wrap the comma(s) so one parameter (not many) is passed to the macro.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">parenthesized_type</code></strong></span></td>
+<td>The type expression wrapped within an extra set of mandatory parenthesis <code class="computeroutput"></code>(). </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The macro in the example above expands to code equivalent to the following: </p>
+<pre class="programlisting"> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">dobule</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="identifier">m</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">wrap</span><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span><span class="special">)</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">m</span><span class="special">)</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">...</span>
+ <span class="special">)</span>
+</pre>
+<p> <span class="bold"><strong>See:</strong></span> <a class="link" href="contract/wrap.html" title="Struct template wrap">contract::wrap</a>, Tutorial section </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract/wrap_void_T__id437104.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract__/Rationale.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/block_invariant_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/block_invariant_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function block_invariant_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="set_block_invariant_failed.html" title="Function set_block_invariant_failed">
+<link rel="next" href="set_class_invariant_failed.html" title="Function set_class_invariant_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_block_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_class_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.block_invariant_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function block_invariant_failed</span></h2>
+<p>contract::block_invariant_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">void</span> <span class="identifier">block_invariant_failed</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span> where<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id959749"></a><h2>Description</h2>
+<p>Automatically invoked by this library when a block invariant condition fails.</p>
+<p>It calls <code class="computeroutput">std::terminate()</code> by default but it can be redefined using <code class="computeroutput">contract::set_block_invariant_failed()</code>. When this function is called, the exception raised by the contract failure is the active unhandled exception (which can be re-thrown using <code class="computeroutput">throw</code> and then caught, see Throw on Failure annex).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">where</code></strong></span></td>
+<td>The source that found the the block invariant failure. </td>
+</tr></tbody>
+</table></div>
+<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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_block_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_class_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/class_invariant_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/class_invariant_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function class_invariant_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="set_class_invariant_failed.html" title="Function set_class_invariant_failed">
+<link rel="next" href="set_precondition_failed.html" title="Function set_precondition_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_class_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_precondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.class_invariant_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function class_invariant_failed</span></h2>
+<p>contract::class_invariant_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">void</span> <span class="identifier">class_invariant_failed</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span> where<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id960041"></a><h2>Description</h2>
+<p>Automatically invoked by this library when a class invariant condition fails.</p>
+<p>It calls <code class="computeroutput">std::terminate()</code> by default but it can be redefined using <code class="computeroutput">contract::set_class_invariant_failed()</code>. When this function is called, the exception raised by the contract failure is the active unhandled exception (which can be re-thrown using <code class="computeroutput">throw</code> and then caught, see Throw on Failure annex).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">where</code></strong></span></td>
+<td>The source that found the the invariant failure. </td>
+</tr></tbody>
+</table></div>
+<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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_class_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_precondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/constructor.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/constructor.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,178 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template constructor</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.constructor_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/constructor.hpp>">
+<link rel="prev" href="../CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html" title="Macro CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE">
+<link rel="next" href="../CONTRACT_CHECK_BLOCK_INVARIANT.html" title="Macro CONTRACT_CHECK_BLOCK_INVARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.constructor_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_CHECK_BLOCK_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.constructor"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template constructor</span></h2>
+<p>contract::constructor</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.constructor_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/constructor.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/constructor.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="constructor.html" title="Class template constructor">constructor</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span> <span class="identifier">F</span> <span class="special">></span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="constructor.html#contract.constructorconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="constructor.html#id431593-bb"><span class="identifier">constructor</span></a><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span><span class="special">,</span> <span class="identifier">__PreconditionFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="constructor.html#id431801-bb"><span class="special">~</span><span class="identifier">constructor</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="constructor.html#id431522-bb">public member functions</a></span>
+ <span class="keyword">void</span> <a class="link" href="constructor.html#id431526-bb"><span class="identifier">call</span></a><span class="special">(</span><span class="identifier">__MaybeCvClassPointer__</span><span class="special">,</span> <span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id966454"></a><h2>Description</h2>
+<p>Class template used to write contracts for constructors.</p>
+<p><span class="bold"><strong>Note:</strong></span> Only the differences between this class and the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> class are documented here. Read the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> documentation first.</p>
+<p>The <code class="computeroutput">CONTRACT_CONSTRUCTOR()</code> macro expands to code that uses this class template (see the Without the Macros section) -- whenever possible, use the macro instead of using this class template directly. Rarely, it might be needed to use this class template directly to implement workarounds for compilers that do not fully comply with the ISO C++ standard.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
+<td>The function type of the constructor function being contracted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>Base contract classes cannot be specified because constructors do not directly subcontract (C++ object construction mechanism will automatically invoke base class contracts when they are present).</p>
+<p>The function type <code class="computeroutput">F</code> must be specified as follows: </p>
+<pre class="programlisting"> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">ClassType</span><span class="special">*</span><span class="special">,</span> <span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumentTypeN</span><span class="special">)</span>
+</pre>
+<p> Note: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The result type is always <code class="computeroutput">void</code> because constructors return no value. </p></li>
+<li class="listitem"><p><code class="computeroutput">ClassType</code> is never <code class="computeroutput">const</code> because constructors can never be constant members (as they modify the object by constructing it). </p></li>
+<li class="listitem"><p><code class="computeroutput">ClassType</code> cannot be tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> because there is no object before constructor body execution (it has not been constructed yet) -- the library will generate a compile-time error otherwise.</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>See:</strong></span> Without the Macros section, <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> </p>
+<div class="refsect2">
+<a name="id966708"></a><h3>
+<a name="contract.constructorconstruct-copy-destruct"></a><code class="computeroutput">constructor</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><a name="id431593-bb"></a><span class="identifier">constructor</span><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span> body_function<span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span> precondition_function<span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span> postcondition_function<span class="special">)</span><span class="special">;</span></pre>
+<p>Construct this contract object using the specified body, preconditions, and postconditions functions.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">body_function</code></strong></span></td>
+<td>A pointer to the function executing the body. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">precondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the preconditions. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">postcondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the postconditions. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation for the definition of metaprogramming constructs used below (<code class="computeroutput">__IfCopyable__</code>, etc).</p>
+<p>The body function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (ClassType::* __BodyFunctionPointer__)
+ ( __RemoveCopyable__< ArgumentType1 >,
+ ...,
+ __RemoveCopyable__< ArgumentTypeN >
+ );
+</pre>
+<p>The precondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type
+ );
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>This is a <span class="bold"><strong>static</strong></span> member function (because is does not specify the class type using <code class="computeroutput">(*)</code> instead of <code class="computeroutput">(ClassType::*)</code>). This ensures that constructor preconditions do not access the object (as before constructor body no object has been constructed yet). </p></li>
+<li class="listitem"><p>The precondition function is never <code class="computeroutput">const</code> (because is must be <code class="computeroutput">static</code>).</p></li>
+</ul></div>
+<p>
+The postcondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (ClassType::* __PreconditionFunctionPointer__)
+ ( contract::noold,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ __IfCopyable__< ArgumentType1,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type >,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type,
+ __IfCopyable__< ArgumentTypeN,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type >
+ ) const;
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The old object value is never available (it is always of type <code class="computeroutput">contract::noold</code>). This ensure that constructor postconditions never access the object old value (as there was no object before constructor body execution). </p></li></ul></div>
+<p>
+</p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id431801-bb"></a><span class="special">~</span><span class="identifier">constructor</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy this contract object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id967077"></a><h3>
+<a name="id431522-bb"></a><code class="computeroutput">constructor</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="keyword">void</span> <a name="id431526-bb"></a><span class="identifier">call</span><span class="special">(</span><span class="identifier">__MaybeCvClassPointer__</span> object<span class="special">,</span> <span class="identifier">ArgumentType1</span> argument1<span class="special">,</span> <span class="special">...</span><span class="special">,</span>
+ <span class="identifier">ArgumetnTypeN</span> argumentN<span class="special">)</span><span class="special">;</span></pre>
+<p>Check the contract and executes the member function body.</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation.</p>
+<p>Accordingly with <code class="computeroutput">F</code>, the <code class="computeroutput">call()</code> function always returns <code class="computeroutput">void</code>. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.constructor_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_CHECK_BLOCK_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/contract_failed_handler.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/contract_failed_handler.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Type definition contract_failed_handler</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="failure.html" title="Class failure">
+<link rel="next" href="set_block_invariant_failed.html" title="Function set_block_invariant_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="failure.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_block_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.contract_failed_handler"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Type definition contract_failed_handler</span></h2>
+<p>contract_failed_handler</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">typedef</span> <span class="identifier">__ContractFailedHandler__</span> <span class="identifier">contract_failed_handler</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id959391"></a><h2>Description</h2>
+<p>Function pointer type of the contract condition failure handler functions.</p>
+<p>Where the function pointer type __ContractFailedHandler__ is defined as follows: </p>
+<pre class="programlisting"> <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(</span><span class="special">*</span> <span class="identifier">contract_failed_handler</span><span class="special">)</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span><span class="special">&</span> <span class="identifier">where</span><span class="special">)</span><span class="special">;</span>
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">where</code></strong></span></td>
+<td>The source that found the condition failure. This is useful for example to program failure handlers that throw exceptions in general but never from within destructors. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> Throw on Failure annex for an example. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="failure.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_block_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/copy.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/copy.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,177 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template copy</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">
+<link rel="prev" href="copyable.html" title="Class template copyable">
+<link rel="next" href="../CONTRACT_OLDOF.html" title="Macro CONTRACT_OLDOF">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="copyable.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_OLDOF.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.copy"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template copy</span></h2>
+<p>contract::copy</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="copy.html" title="Class template copy">copy</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="copy.html#contract.copyconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="copy.html#id436197-bb"><span class="identifier">copy</span></a><span class="special">(</span><span class="identifier">__ConstRef__</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="copy.html#contract.copypublic-data-members">public data members</a></span>
+ <span class="identifier">__ConstType__</span> <a class="link" href="copy.html#contract.copy.value"><span class="identifier">value</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id976743"></a><h2>Description</h2>
+<p>Copy wrapper used by the library to make the actual copy of variables for which old values are needed in postconditions.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type of the object being copied. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> Under most circumstances programmers do <span class="bold"><strong>not</strong></span> need to use this class which is usually just used internally by the library.</p>
+<p>Specifically, if the copied type <code class="computeroutput">T</code> already has a public constant-correct copy constructor then the <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> template will use such a constructor by default and programmers do not need to define any specialization of the <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> template. </p>
+<pre class="programlisting"> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">T</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">source</span><span class="special">)</span><span class="special">;</span> <span class="comment">// Public constant-correct copy constructor.</span>
+
+ <span class="special">...</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p> The constructor needs to be public for the library to access it and it needs to be contract-correct for the library to use it while still ensuring the contract-correctness of the contract checking code.</p>
+<p>However, the <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> template can be specialized by programmers to expose a non-public constant-correct copy constructor to the library via friendship: </p>
+<pre class="programlisting"> <span class="keyword">class</span> <span class="identifier">x</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// User class with no public copy constructor.</span>
+
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// Only the library can access this copy constructor via friendship.</span>
+ <span class="keyword">friend</span> <span class="keyword">class</span> <a class="link" href="copy.html" title="Class template copy">contract::copy</a><span class="special"><</span><span class="identifier">x</span><span class="special">></span><span class="special">;</span>
+ <span class="identifier">x</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">x</span><span class="special">*</span> <span class="identifier">source</span><span class="special">)</span><span class="special">;</span> <span class="comment">// Constant-correct (private) copy constructor.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p>Furthermore, programmers can specialize the <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> template for a user defined type in order to relax the library requirement of an accessible constant-correct copy constructor all together (it is recommended <span class="bold"><strong>not</strong></span> to do this unless strictly necessary). </p>
+<pre class="programlisting"> <span class="keyword">class</span> <span class="identifier">y</span><span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">noncopyable</span> <span class="special">{</span> <span class="comment">// User class with no copy constructor at all.</span>
+ <span class="comment">// Self backup copy maintained by the class itself.</span>
+ <span class="identifier">y</span> <span class="identifier">backup_copy</span><span class="special">;</span> <span class="comment">// Use this as the old value.</span>
+
+ <span class="special">...</span>
+ <span class="special">}</span><span class="special">;</span>
+
+ <span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+
+ <span class="comment">// Specialization to handle y old value without copying it.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">copy</span><span class="special"><</span><span class="identifier">y</span><span class="special">></span> <span class="special">{</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// It must declare a member variable named `value`.</span>
+ <span class="keyword">const</span> <span class="identifier">y</span><span class="special">&</span> <span class="identifier">value</span><span class="special">;</span> <span class="comment">// Maintains constant-correctness by using const member.</span>
+
+ <span class="comment">// It must defined this copy constructor. It must maintains</span>
+ <span class="comment">// constant-correctness taking a constant reference to `source`.</span>
+ <span class="identifier">copy</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">y</span><span class="special">&</span> <span class="identifier">source</span><span class="special">)</span><span class="special">:</span>
+ <span class="comment">// This does not copy `source` (`value` is a reference).</span>
+ <span class="comment">// Instead it uses its `source` existing backup copy.</span>
+ <span class="identifier">value</span><span class="special">(</span><span class="identifier">source</span><span class="special">.</span><span class="identifier">backup_copy</span><span class="special">)</span> <span class="special">{</span><span class="special">}</span>
+ <span class="special">}</span><span class="special">;</span>
+
+ <span class="special">}</span> <span class="comment">// namespace</span>
+</pre>
+<p>The <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> template can also be specialized to alter the copy semantics for a type (it is recommended <span class="bold"><strong>not</strong></span> to do this unless strictly necessary). For example, by default a pointer to a double number <code class="computeroutput">double*</code> is copied by copying the pointer value and not by copying the pointed number (this is the usual C++ copy semantic for pointers). The following specialization of <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> copies the pointed number instead of the pointer value for postcondition old values of argument of type <code class="computeroutput">double*</code>. </p>
+<pre class="programlisting"> <span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="special">></span>
+ <span class="keyword">class</span> <span class="identifier">copy</span><span class="special"><</span><span class="keyword">double</span><span class="special">*</span><span class="special">></span> <span class="special">{</span>
+ <span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">double</span> <span class="identifier">number_</span><span class="special">;</span> <span class="comment">// Copied pointed number value.</span>
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">const</span> <span class="keyword">double</span><span class="special">*</span> <span class="identifier">value</span><span class="special">;</span> <span class="comment">// Pointer to number_.</span>
+
+ <span class="identifier">copy</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">*</span> <span class="identifier">number_ptr</span><span class="special">)</span><span class="special">:</span> <span class="identifier">number_</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="identifier">value</span><span class="special">(</span><span class="special">&</span><span class="identifier">number_</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Check pointer is valid.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="special">!</span><span class="identifier">number_ptr</span><span class="special">)</span> <span class="keyword">throw</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span><span class="special">(</span><span class="string">"Invalid number pointer"</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">number_</span> <span class="special">=</span> <span class="special">*</span><span class="identifier">number_ptr</span><span class="special">;</span> <span class="comment">// Copy the *pointed* number.</span>
+ <span class="special">}</span>
+ <span class="special">}</span><span class="special">;</span>
+
+ <span class="special">}</span> <span class="comment">// namespace</span>
+</pre>
+<p>See also the Examples section for a concrete example that specializes <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> to relax the accessible constant-correct constructor requirement. </p>
+<div class="refsect2">
+<a name="id977971"></a><h3>
+<a name="contract.copyconstruct-copy-destruct"></a><code class="computeroutput">copy</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><a name="id436197-bb"></a><span class="identifier">copy</span><span class="special">(</span><span class="identifier">__ConstRef__</span> source<span class="special">)</span><span class="special">;</span></pre>
+<p>Constructor which copies the specified object.</p>
+<p>The copy is done by constructing the member variable `value` using an accessible constant-correct copy constructor for <code class="computeroutput">T</code> (which must be available otherwise the library will generate a compile-time error).</p>
+<p><span class="bold"><strong>Note:</strong></span> Source is a constant reference so to ensure contract checking constant-correctness (correctly, this constraint cannot be relaxed not even by specializing this class template).</p>
+<p>The constant reference type is defined as follows: </p>
+<pre class="programlisting"> typedef typename boost::add_reference<const_type>::type __ConstRef__;
+</pre>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">source</code></strong></span></td>
+<td>The source object to be copied into the <code class="computeroutput">value</code> member variable. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+</li></ol></div>
+</div>
+<div class="refsect2">
+<a name="id978108"></a><h3>
+<a name="contract.copypublic-data-members"></a><code class="computeroutput">copy</code>
+ public
+ public data members</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="identifier">__ConstType__</span> <a name="contract.copy.value"></a><span class="identifier">value</span><span class="special">;</span></pre>
+<p>The copied value (used as the old value in postconditions).</p>
+<p>The variable type is defined as follows: </p>
+<pre class="programlisting"> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">add_const</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">remove_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span><span class="special">></span><span class="special">::</span><span class="identifier">type</span> <span class="identifier">__ConstType__</span><span class="special">;</span>
+</pre>
+<p> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="copyable.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_OLDOF.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/copyable.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/copyable.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,75 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template copyable</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">
+<link rel="prev" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">
+<link rel="next" href="copy.html" title="Class template copy">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonstatic_member_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="copy.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.copyable"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template copyable</span></h2>
+<p>contract::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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="copyable.html" title="Class template copyable">copyable</a> <span class="special">{</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id976260"></a><h2>Description</h2>
+<p>Tag the specified type <code class="computeroutput">T</code> copyable.</p>
+<p>In general, you should tag a type copyable <span class="bold"><strong>only</strong></span> when the related variable old value (before body execution) is really needed in postconditions because:</p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem"><p>The correspondent variable value will be copied before body execution adding run-time overhead. The library performs the extra copy to support old values in postconditions only for variables of types tagged copyable and only when the <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code> macro is defined.</p></li>
+<li class="listitem">
+<p>A type tagged copyable has the extra requirement that it must define an accessible constant-correct copy constructor (otherwise the library will generate a compile-time error). The copy constructor is constant-correct when it accesses the copied value via a constant reference argument (this way the copied value cannot be mistakenly modified while it is being copied to check contracts): </p>
+<pre class="programlisting"> <span class="identifier">T</span><span class="special">::</span><span class="identifier">T</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">source</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span> <span class="comment">// Must be accessible and construct from a const&.</span>
+</pre>
+<p> See <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> to relax this requirement.</p>
+</li>
+</ol></div>
+<p>
+</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>The type to be tagged. The <span class="bold"><strong>entire</strong></span> type with eventual <code class="computeroutput">const</code>, <code class="computeroutput">&</code>, <code class="computeroutput">*</code>, etc qualifier should be tagged copyable. For example, if the type is <code class="computeroutput">const int&</code> then <code class="computeroutput">contract::copyable<const int&></code> should be used (and not <code class="computeroutput">const contract::copyable<int>&</code>). </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> When using the contract macros, <code class="computeroutput">(copyable)(T)</code> is used instead of <code class="computeroutput">contract::copyable<T></code> to tag the type <code class="computeroutput">T</code> copyable in the macro <code class="computeroutput">sequence</code> parameter.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">CONTRACT_OLDOF()</code>, <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonstatic_member_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="copy.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/destructor.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/destructor.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,130 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template destructor</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.destructor_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/destructor.hpp>">
+<link rel="prev" href="../CONTRACT_CHECK_POSTCONDITION.html" title="Macro CONTRACT_CHECK_POSTCONDITION">
+<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"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_CHECK_POSTCONDITION.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.destructor_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="from.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.destructor"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template destructor</span></h2>
+<p>contract::destructor</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.destructor_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/destructor.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/destructor.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="destructor.html" title="Class template destructor">destructor</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span> <span class="identifier">F</span> <span class="special">></span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="destructor.html#contract.destructorconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="destructor.html#id432227-bb"><span class="identifier">destructor</span></a><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="destructor.html#id432297-bb"><span class="special">~</span><span class="identifier">destructor</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="destructor.html#id432179-bb">public member functions</a></span>
+ <span class="keyword">void</span> <a class="link" href="destructor.html#id432183-bb"><span class="identifier">call</span></a><span class="special">(</span><span class="identifier">__MaybeCvClassPointer__</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id968109"></a><h2>Description</h2>
+<p>Class template used to write contracts for destructors.</p>
+<p><span class="bold"><strong>Note:</strong></span> Only the differences between this class and the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> class are documented here. Read the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> documentation first.</p>
+<p>The <code class="computeroutput">CONTRACT_DESTRUCTOR()</code> macro expands to code that uses this class template (see the Without the Macros section) -- whenever possible, use the macro instead of using this class template directly. Rarely, it might be needed to use this class template directly to implement workarounds for compilers that do not fully comply with the ISO C++ standard.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
+<td>The function type for the destructor being contracted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>Base contract classes cannot be specified because destructors do not directly subcontract (C++ object destruction mechanism will automatically invoke base class contracts when they are present).</p>
+<p>The function type <code class="computeroutput">F</code> must be specified as follows: </p>
+<pre class="programlisting"> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">ClassType</span><span class="special">::</span><span class="special">*</span><span class="special">)</span><span class="special">(</span><span class="special">)</span>
+</pre>
+<p> Note: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The result type is always <code class="computeroutput">void</code> because destructors return no value. </p></li>
+<li class="listitem"><p><code class="computeroutput">ClassType</code> is never <code class="computeroutput">const</code> because destructors can never be constant members (as they modify the object by destructing it). </p></li>
+<li class="listitem"><p><code class="computeroutput">ClassType</code> cannot be tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> because there is no object before destructor body execution (it has not been destructed yet) -- the library will generate a compile-time error otherwise. </p></li>
+<li class="listitem"><p>There is no function argument type because destructors take no argument.</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>See:</strong></span> Without the Macros section, <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> </p>
+<div class="refsect2">
+<a name="id968346"></a><h3>
+<a name="contract.destructorconstruct-copy-destruct"></a><code class="computeroutput">destructor</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><a name="id432227-bb"></a><span class="identifier">destructor</span><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span> body_function<span class="special">)</span><span class="special">;</span></pre>
+<p>Construct this contract object using the specified body.</p>
+<p>No precondition and no postcondition function is specified (destructors only check class invariants). This is because destructors have no arguments so there are no preconditions, in addition there is no object after destructor body execution so there are no postconditions (see Tutorial section for more information).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">body_function</code></strong></span></td>
+<td>A pointer to the function executing the body. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>The body function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (ClassType::* __BodyFunctionPointer__)();
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Destructor body takes no argument. </p></li></ul></div>
+<p>
+</p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id432297-bb"></a><span class="special">~</span><span class="identifier">destructor</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy this contract object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id968514"></a><h3>
+<a name="id432179-bb"></a><code class="computeroutput">destructor</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="keyword">void</span> <a name="id432183-bb"></a><span class="identifier">call</span><span class="special">(</span><span class="identifier">__MaybeCvClassPointer__</span> object<span class="special">)</span><span class="special">;</span></pre>
+<p>Check the contract and executes the member function body.</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation.</p>
+<p>Accordingly with <code class="computeroutput">F</code>, the <code class="computeroutput">call()</code> function always returns void and it takes no argument. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_CHECK_POSTCONDITION.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.destructor_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="from.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/failure.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/failure.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,140 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class failure</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="../reference.html" title="Reference">
+<link rel="next" href="contract_failed_handler.html" title="Type definition contract_failed_handler">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="contract_failed_handler.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.failure"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class failure</span></h2>
+<p>contract::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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">class</span> <a class="link" href="failure.html" title="Class failure">failure</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="failure.html#contract.failureconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <span class="keyword">explicit</span> <a class="link" href="failure.html#id425493-bb"><span class="identifier">failure</span></a><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">long</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="special">=</span> <span class="string">""</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="failure.html#id263277-bb"><span class="identifier">failure</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="failure.html" title="Class failure">failure</a> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+ failure& <a class="link" href="failure.html#id263293-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="failure.html" title="Class failure">failure</a> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="failure.html#id263309-bb"><span class="special">~</span><span class="identifier">failure</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="failure.html#id425420-bb">public member functions</a></span>
+ <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <a class="link" href="failure.html#id425424-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">const</span> <span class="keyword">char</span> <span class="special">*</span> <a class="link" href="failure.html#id425448-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="failure.html#id425462-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">const</span> <span class="keyword">char</span> <span class="special">*</span> <a class="link" href="failure.html#id425475-bb"><span class="identifier">description</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="id958496"></a><h2>Description</h2>
+<p>Default exception thrown when a contract condition is found to be false.</p>
+<p>It is recommended to assert contract conditions using the <code class="computeroutput">CONTRACT_ASSERT()</code> macro instead of throwing this exception directly.</p>
+<p>The library handles exceptions (any exception, not just this one) when thrown from within block invariants (plus loop variants), class invariants, preconditions, and postconditions invoking <code class="computeroutput">contract::block_invariant_failed()</code>, <code class="computeroutput">contract::class_invariant_failed()</code>, <code class="computeroutput">contract::precondition_failed()</code>, and <code class="computeroutput">contract::postcondition_failed()</code> respectively (see the Without the Macros section).</p>
+<p>Therefore, throwing this exception on a contract condition failure does <span class="bold"><strong>not</strong></span> imply that an exception will be thrown overall to handle the failure. It only implies that the correct contract failure handler function will be automatically invoked by the library (after checking eventual overridden contracts for subcontracting, etc). It is not possible to call the failure handler functions directly instead of throwing the exception because that will not allow the library to check overridden contracts when subcontracting. The failure handler functions will then decide the action to take (the default handlers provided by the library invoke <code class="computeroutput">std::terminate()</code> but programmers can redefine this behaviour using <code class="computeroutput">contract::set_block_invariant_failed()</code>, <code class="computeroutput">contract::set_class_invariant_failed()</code>, <code class="computeroutput">contract::set_precondition_failed()</code>, and <cod
e class="computeroutput">contract::set_postcondition_failed()</code>).</p>
+<p>The member functions of this class do not throw (their exception specification is <code class="computeroutput">thow()</code>) so they can be safely used when checking contracts in compliance with STL C++ exception safety requirements at all times.</p>
+<p><span class="bold"><strong>See:</strong></span> Without the Macros section. </p>
+<div class="refsect2">
+<a name="id958633"></a><h3>
+<a name="contract.failureconstruct-copy-destruct"></a><code class="computeroutput">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="id425493-bb"></a><span class="identifier">failure</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> file<span class="special">,</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">long</span> <span class="special">&</span> line<span class="special">,</span>
+ <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> description <span class="special">=</span> <span class="string">""</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Create a condition failure object.</p>
+<p>All the constructor parameters are used to provide more descriptive error messages in case of contract condition failure. At least the file and line number must be specified so to uniquely identify the point of the contract condition failure.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">file</code></strong></span></td>
+<td>The source code file containing the failed contract condition (use <code class="computeroutput">__FILE__</code>). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">line</code></strong></span></td>
+<td>The source code line number containing the failed contract condition (use <code class="computeroutput">__LINE__</code>). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">description</code></strong></span></td>
+<td>An optional human readable description of the contract condition failure (<code class="computeroutput">""</code> if not specified). </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id263277-bb"></a><span class="identifier">failure</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="failure.html" title="Class failure">failure</a> <span class="special">&</span> source<span class="special">)</span><span class="special">;</span></pre>
+<p>Create a condition failure object copying it from the specified one. </p>
+</li>
+<li class="listitem">
+<pre class="literallayout">failure& <a name="id263293-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="failure.html" title="Class failure">failure</a> <span class="special">&</span> source<span class="special">)</span><span class="special">;</span></pre>
+<p>Copy a condition failure from the specified one. </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id263309-bb"></a><span class="special">~</span><span class="identifier">failure</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy the condition failure object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id959038"></a><h3>
+<a name="id425420-bb"></a><code class="computeroutput">failure</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <a name="id425424-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>
+<p>Return a human readable message explaining the nature of the condition failure.</p>
+<p><span class="bold"><strong>Returns:</strong></span> The actual message text is library implementation specific but it will contain the condition description, the file name, and the line number (when specified). For example, the returned message could look like this: </p>
+<pre class="programlisting"> contract "size increased by 1" failed at myvector.cpp:40
+</pre>
+<p> </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <a name="id425448-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>
+<p>Return the condition failure source file. </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><span class="keyword">unsigned</span> <span class="keyword">long</span> <a name="id425462-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>
+<p>Return the condition failure source line number. </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <a name="id425475-bb"></a><span class="identifier">description</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
+<p>Return the condition failure description (<code class="computeroutput">""</code> if not specified). </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="contract_failed_handler.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/from.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/from.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Type from</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.from_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/from.hpp>">
+<link rel="prev" href="destructor.html" title="Class template destructor">
+<link rel="next" href="../CONTRACT_INVARIANT.html" title="Macro CONTRACT_INVARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="destructor.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.from_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.from"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Type from</span></h2>
+<p>contract::from</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.from_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/from.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/from.hpp</a>>
+
+</span>
+<span class="keyword">enum</span> <span class="identifier">from</span> <span class="special">{</span> <a class="link" href="from.html#contract.from.FROM_CONSTRUCTOR">FROM_CONSTRUCTOR</a>, <a class="link" href="from.html#contract.from.FROM_DESTRUCTOR">FROM_DESTRUCTOR</a>, <a class="link" href="from.html#contract.from.FROM_NONSTATIC_MEMBER_FUNCTION">FROM_NONSTATIC_MEMBER_FUNCTION</a>,
+ <a class="link" href="from.html#contract.from.FORM_STATIC_MEMBER_FUNCTION">FORM_STATIC_MEMBER_FUNCTION</a>, <a class="link" href="from.html#contract.from.FROM_NONMEMBER_FUNCTION">FROM_NONMEMBER_FUNCTION</a>, <a class="link" href="from.html#contract.from.FROM_BLOCK">FROM_BLOCK</a> <span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id968823"></a><h2>Description</h2>
+<p>Source that found the contract condition failure.</p>
+<p>For example, this is used in the Throw on Failure annex to ensure that destructors never throw to comply with C++ STL exception safety requirements.</p>
+<p>These failure sources are identified separately because they all have different contract checking semantics with respect to each other (see the Tutorial section).</p>
+<p><span class="bold"><strong>Warning:</strong></span> You must not assume any specific integer value for these enumerated values. Only use the enumerated values because the integer values they map to are library implementation specific and they could change in future revisions of the library.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput">contract::contract_failed_handler</code> </p>
+<div class="variablelist"><dl>
+<dt><span class="term"><code class="computeroutput">FROM_CONSTRUCTOR</code><a name="contract.from.FROM_CONSTRUCTOR"></a></span></dt>
+<dd><p>Contract condition failed from a constructor. </p></dd>
+<dt><span class="term"><code class="computeroutput">FROM_DESTRUCTOR</code><a name="contract.from.FROM_DESTRUCTOR"></a></span></dt>
+<dd><p>Contract condition failed from a destructor. </p></dd>
+<dt><span class="term"><code class="computeroutput">FROM_NONSTATIC_MEMBER_FUNCTION</code><a name="contract.from.FROM_NONSTATIC_MEMBER_FUNCTION"></a></span></dt>
+<dd><p>Contract condition failed from a non-static member function. </p></dd>
+<dt><span class="term"><code class="computeroutput">FORM_STATIC_MEMBER_FUNCTION</code><a name="contract.from.FORM_STATIC_MEMBER_FUNCTION"></a></span></dt>
+<dd><p>Contract condition failed from a static member function. </p></dd>
+<dt><span class="term"><code class="computeroutput">FROM_NONMEMBER_FUNCTION</code><a name="contract.from.FROM_NONMEMBER_FUNCTION"></a></span></dt>
+<dd><p>Contract condition failed from a non-member function. </p></dd>
+<dt><span class="term"><code class="computeroutput">FROM_BLOCK</code><a name="contract.from.FROM_BLOCK"></a></span></dt>
+<dd><p>Contract condition failed from a code block. </p></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="destructor.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.from_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/loop_variant_type.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/loop_variant_type.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Type definition loop_variant_type</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">
+<link rel="prev" href="../CONTRACT_ASSERT_MSG.html" title="Macro CONTRACT_ASSERT_MSG">
+<link rel="next" href="../CONTRACT_ASSERT_BLOCK_INVARIANT.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_ASSERT_MSG.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_ASSERT_BLOCK_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.loop_variant_type"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Type definition loop_variant_type</span></h2>
+<p>loop_variant_type</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp</a>>
+
+</span>
+<span class="keyword">typedef</span> <span class="identifier">__Integer__</span> <span class="identifier">loop_variant_type</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id961515"></a><h2>Description</h2>
+<p>The type of the loop variant expression.</p>
+<p>The <code class="computeroutput">__Integer__</code> type is a signed integer type but its actual type is library implementation specific.</p>
+<p><span class="bold"><strong>Note:</strong></span> While the loop variant expression type is signed, the loop variant value is asserted to be always positive (<code class="computeroutput">> 0</code>).</p>
+<p>For example, you can use this type to convert (not cast) the variant expression into the variant type: </p>
+<pre class="programlisting"> <span class="identifier">CONTRACT_INIT_LOOP_VARIANT</span><span class="special">;</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span><span class="special">(</span> <span class="identifier">loop_variant_type</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">)</span><span class="special">;</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p> Note this is <span class="bold"><strong>not</strong></span> a type cast so it will generate a compile-time error if the type conversion if not possible. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_ASSERT_MSG.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_ASSERT_BLOCK_INVARIANT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/nonmember_function.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/nonmember_function.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,167 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template nonmember_function</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonmember_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonmember_function.hpp>">
+<link rel="prev" href="../CONTRACT_FUNCTION.html" title="Macro CONTRACT_FUNCTION">
+<link rel="next" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_FUNCTION.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonmember_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="nonstatic_member_function.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.nonmember_function"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template nonmember_function</span></h2>
+<p>contract::nonmember_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonmember_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonmember_function.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonmember_function.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="nonmember_function.html" title="Class template nonmember_function">nonmember_function</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="nonmember_function.html#contract.nonmember_functionconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="nonmember_function.html#id434379-bb"><span class="identifier">nonmember_function</span></a><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span><span class="special">,</span> <span class="identifier">__PreconditionFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="nonmember_function.html#id434552-bb"><span class="special">~</span><span class="identifier">nonmember_function</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="nonmember_function.html#id434323-bb">public member functions</a></span>
+ <span class="identifier">ResultType</span> <a class="link" href="nonmember_function.html#id434326-bb"><span class="identifier">call</span></a><span class="special">(</span><span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id973041"></a><h2>Description</h2>
+<p>Class template used to write contracts for non-member functions.</p>
+<p><span class="bold"><strong>Note:</strong></span> Only the differences between this class and the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> class are documented here. Read the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> documentation first.</p>
+<p>The <code class="computeroutput">CONTRACT_FUNCTION()</code> macro expands to code that uses this class template (when no <code class="computeroutput">(class)</code> is specified in the function signature sequence, see the Without the Macros section) -- whenever possible, use the macro instead of using this class template directly. Rarely, it might be needed to use this template class directly to implement workarounds for compilers that do not fully comply with the ISO C++ standard.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
+<td>The function type of the non-member function being contracted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>The function type <code class="computeroutput">F</code> must be specified as follows: </p>
+<pre class="programlisting"> <span class="identifier">ResultType</span> <span class="special">(</span><span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumentTypeN</span><span class="special">)</span>
+</pre>
+<p><span class="bold"><strong>See:</strong></span> Without the Macros section, <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> </p>
+<div class="refsect2">
+<a name="id973216"></a><h3>
+<a name="contract.nonmember_functionconstruct-copy-destruct"></a><code class="computeroutput">nonmember_function</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><a name="id434379-bb"></a><span class="identifier">nonmember_function</span><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span> body_function<span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span> precondition_function<span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span> postcondition_function<span class="special">)</span><span class="special">;</span></pre>
+<p>Construct this contract object using the specified body, preconditions, and postconditions functions.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">body_function</code></strong></span></td>
+<td>A pointer to the function executing the body. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">precondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the preconditions. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">postcondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the postconditions. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation for the definition of metaprogramming constructs used below (<code class="computeroutput">__IfCopyable__</code>, etc).</p>
+<p>Note the followings for the function pointer types defined below: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>They are non-member functions. </p></li>
+<li class="listitem"><p>There is no old object value in postconditions, not even <code class="computeroutput">contract::noold</code> (because non-member functions have no object).</p></li>
+</ul></div>
+<p>
+The body function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __BodyFunctionPointer__)
+ ( __RemoveCopyable__< ArgumentType1 >,
+ ...,
+ __RemoveCopyable__< ArgumentTypeN >
+ );
+</pre>
+<p>The precondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type
+ );
+</pre>
+<p>The postcondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable< ArgumentType1 > >::type>::type,
+ __IfCopyable__< ArgumentType1,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type >,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type,
+ __IfCopyable__< ArgumentTypeN,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable< ArgumentTypeN > >::type>::type >,
+ __IfNonVoid__< boost::add_reference<boost::add_const<
+ ResultType>::type>::type >
+ );
+</pre>
+<p> </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id434552-bb"></a><span class="special">~</span><span class="identifier">nonmember_function</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy this contract object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id973538"></a><h3>
+<a name="id434323-bb"></a><code class="computeroutput">nonmember_function</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="identifier">ResultType</span> <a name="id434326-bb"></a><span class="identifier">call</span><span class="special">(</span><span class="identifier">ArgumentType1</span> argument1<span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span> argumentN<span class="special">)</span><span class="special">;</span></pre>
+<p>Check the contract and executes the member function body.</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation.</p>
+<p>The <code class="computeroutput">call()</code> function takes no object (because the contracted function is not a member). </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_FUNCTION.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonmember_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="nonstatic_member_function.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/nonstatic_member_function.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/nonstatic_member_function.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,283 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template nonstatic_member_function</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonstatic_member_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonstatic_member_function.hpp>">
+<link rel="prev" href="nonmember_function.html" title="Class template nonmember_function">
+<link rel="next" href="copyable.html" title="Class template copyable">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonmember_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonstatic_member_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="copyable.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.nonstatic_member_function"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template nonstatic_member_function</span></h2>
+<p>contract::nonstatic_member_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonstatic_member_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonstatic_member_function.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonstatic_member_function.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">,</span> <span class="keyword">typename</span> BaseContractClass1 <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="special">...</span> <span class="special">,</span>
+ <span class="keyword">typename</span> BaseContractClassM <span class="special">=</span> <span class="keyword">void</span><span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">nonstatic_member_function</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="nonstatic_member_function.html#contract.nonstatic_member_functionconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="nonstatic_member_function.html#id435431-bb"><span class="identifier">nonstatic_member_function</span></a><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="nonstatic_member_function.html#id435745-bb"><span class="special">~</span><span class="identifier">nonstatic_member_function</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="nonstatic_member_function.html#id435225-bb">public member functions</a></span>
+ <span class="identifier">ResultType</span> <a class="link" href="nonstatic_member_function.html#id435229-bb"><span class="identifier">call</span></a><span class="special">(</span><span class="identifier">__MaybeCVClassPointer__</span><span class="special">,</span> <span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id974179"></a><h2>Description</h2>
+<p>Class template used to write contracts for non-static member functions.</p>
+<p><span class="bold"><strong>Note:</strong></span> This class is used to write contracts for non-static member functions but it cannot be used for static-member functions (see <code class="computeroutput">contract::static_member</code>), constructors (see <code class="computeroutput"><a class="link" href="constructor.html" title="Class template constructor">contract::constructor</a></code>), destructors (see <code class="computeroutput"><a class="link" href="destructor.html" title="Class template destructor">contract::destructor</a></code>), and non-m ember functions (see <code class="computeroutput"><a class="link" href="nonmember_function.html" title="Class template nonmember_function">contract::nonmember_function</a></code>) because they have different contract checking semantics.</p>
+<p>The <code class="computeroutput">CONTRACT_FUNCTION()</code> macro expands to code that uses this class template (see the Without the Macros section) -- whenever possible, use the macro instead of using this class template directly. Rarely, it might be needed to use this class template directly to implement workarounds for compilers that do not fully comply with the ISO C++ standard.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
+<td>The function type of the function being contracted. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">BaseContractClass1, ..., BaseContractClassM</code></strong></span></td>
+<td>These are the contracts from which the member function is subcontracting. These are all optional, they are only specified when the member function is subcontracting: no base contract is specified if no subcontracting, only <code class="computeroutput">BaseContractClass1</code> is specified to subcontract from 1 base class only, and more base contract classes are specified to support subcontracting with multiple inheritance. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>Each of these types must inherit from <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> (so to be a contract class) and its class type must be a base class of the contracted class (otherwise the library will generate a compile-time error). </p></li>
+<li class="listitem"><p>When multiple base contract classes are specified, the overridden contracts are checked following the order of the specified template parameters. The derived class contract is checked last. </p></li>
+<li class="listitem"><p>The maximum number of supported base class contracts <span class="emphasis"><em>M</em></span> is specified by the <code class="computeroutput">CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</code> configuration macro. </p></li>
+</ul></div>
+</td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p>The following metaprogramming constructs (e.g., <code class="computeroutput">__AMetaprogrammingConstruct__</code>) are used in this documentation to define the different types:</p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>If <code class="computeroutput">S</code> is <code class="computeroutput">contract::copyable<T></code> then <code class="computeroutput">__RemoveCopyable__< S ></code> is <code class="computeroutput">T</code>, otherwise it is <code class="computeroutput">S</code> (i.e., this removes the eventual <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> tag from the specified type).</p></li>
+<li class="listitem"><p><code class="computeroutput">__UncopyableClassType__</code> is <code class="computeroutput">__RemoveCopyable__< __RemoveCV__< ClassType > ></code>.</p></li>
+<li class="listitem"><p>If <code class="computeroutput">ClassType</code> is cv-qualified then <code class="computeroutput">__MaybeCV__</code> is the cv-qualifier (<code class="computeroutput">const</code>, <code class="computeroutput">volatile</code>, or <code class="computeroutput">const volatile</code>), otherwise it is nothing.</p></li>
+<li class="listitem"><p>If <code class="computeroutput">S</code> is tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> then <code class="computeroutput"> __IfCopyable__< S, T ></code> is the <code class="computeroutput">T</code>, otherwise it is the <code class="computeroutput">contract::noold</code>.</p></li>
+<li class="listitem"><p>If <code class="computeroutput">F</code> has a non-void <code class="computeroutput">ResultType</code> then <code class="computeroutput">__IfNonVoid__< C ></code> is <code class="computeroutput">C</code>, otherwise it is nothing.</p></li>
+<li class="listitem"><p><code class="computeroutput">__MaybeCvClassPointer__</code> is a pointer to <code class="computeroutput">__UncopyableClassType__</code> with the same cv-qualifier of <code class="computeroutput">ClassType</code> (<code class="computeroutput">*</code>, <code class="computeroutput">const*</code>, <code class="computeroutput">volatile*</code>, or <code class="computeroutput">const volatile*</code>).</p></li>
+</ul></div>
+<p>
+</p>
+<p>These metaporgramming constructs are <span class="bold"><strong>not</strong></span> templates. They are internally implemented by the library using both preprocessor and template metaprogramming (in a way that is intentionally <span class="emphasis"><em>not</em></span> documented here because it is library implementation specific).</p>
+<p>The function type template parameter <code class="computeroutput">F</code> must be specified as follows: </p>
+<pre class="programlisting"> <span class="identifier">ResultType</span> <span class="special">(</span><span class="identifier">ClassType</span><span class="special">*</span><span class="special">,</span> <span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumentTypeN</span><span class="special">)</span>
+</pre>
+<p>Where: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The <code class="computeroutput">ResultType</code> is the function result type (use <code class="computeroutput">void</code> for functions that have no return value). </p></li>
+<li class="listitem"><p>The <code class="computeroutput">ClassType</code> is the type of the class the function is member of. </p></li>
+<li class="listitem"><p>For constant member functions <code class="computeroutput">const</code> qualifies the class type. </p></li>
+<li class="listitem"><p>The class type <code class="computeroutput">ClassType</code> (together with its eventual <code class="computeroutput">const</code> qualifier) can be tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> as in <code class="computeroutput">contract::copyable<ClassType __ConstIfContractMemeber__>*</code> if the object old value <code class="computeroutput">CONTRACT_OLDOF(this)</code> is needed in the postconditions (in this case the class must have an accessible constant-correct copy constructor, see <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code>). Note that <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> does <span class="bold"><strong>not</strong></span> wrap the pointer operator (i.e., <code class="computeroutput">contract::copyable<ClassType __Cons
tIfContractMemeber__*></code> is invalid). </p></li>
+<li class="listitem">
+<p>The class type must declare a (private) mutable member variable of a friend type <code class="computeroutput"><a class="link" href="state.html" title="Class state">contract::state</a></code> with the predefined name <code class="computeroutput">contract_state_</code> otherwise the library will generate a compile-time error. This member variable is mainly used by the library to keep track of when contracts are being checked so to disable assertion checking in nested member function calls that could otherwise result in infinite recursion (see the Without the Macros section). </p>
+<pre class="programlisting"> <span class="keyword">class</span> <span class="identifier">ClassType</span> <span class="special">{</span>
+
+ <span class="comment">// Optional contract compilation.</span>
+ <span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">BOOST_CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">BOOST_CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> \
+ <span class="identifier">defined</span> <span class="identifier">BOOST_CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Augmented state.</span>
+ <span class="keyword">friend</span> <a class="link" href="state.html" title="Class state">contract::state</a><span class="special">;</span>
+ <span class="keyword">mutable</span> <a class="link" href="state.html" title="Class state">contract::state</a> <span class="identifier">contract_state_</span><span class="special">;</span>
+ <span class="preprocessor">#endif</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+ <span class="special">}</span><span class="special">;</span>
+</pre>
+<p> Whenever possible, use the <code class="computeroutput">CONTRACT_INVARIANT()</code> macro instead of declaring <code class="computeroutput">contract_state_</code> directly. </p>
+</li>
+<li class="listitem"><p>The function argument types <code class="computeroutput">ArgumentType1</code>, ..., <code class="computeroutput">ArgumentTypeN</code> are all optional (specify none for a function with no argument, only <code class="computeroutput">ArgumentType1</code> is specified for a function with one argument, etc). </p></li>
+<li class="listitem"><p>Any of the argument type can be tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> if the old value <code class="computeroutput">CONTRACT_OLDOF(argument-name)</code> (before body execution) of the related argument is needed in postconditions. Types tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> must have an accessible constant-correct copy constructor (otherwise the library will generate a compile-time error, see <code class="computeroutput"><a class="link" href="copy.html" title="Class template copy">contract::copy</a></code>). The eventual <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> tag must wrap the <span class="bold"><strong>entire</strong></span> argument type (including the pointer operator if present, this is different from t
he class type). </p></li>
+<li class="listitem"><p>The maximum number of supported function arguments <span class="emphasis"><em>N</em></span> is specified by the <code class="computeroutput">CONTRACT_CONFIG_MAX_FUNCTION_ARITY</code> configuration macro.</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>See:</strong></span> Without the Macros section </p>
+<div class="refsect2">
+<a name="id975184"></a><h3>
+<a name="contract.nonstatic_member_functionconstruct-copy-destruct"></a><code class="computeroutput">nonstatic_member_function</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><a name="id435431-bb"></a><span class="identifier">nonstatic_member_function</span><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span> body_function<span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span> precondition_function<span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span> postcondition_function<span class="special">)</span><span class="special">;</span></pre>
+<p>Construct this contract object using the specified body, preconditions, and postconditions functions.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">body_function</code></strong></span></td>
+<td>A pointer to the function executing the body. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">precondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the preconditions. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">postcondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the postconditions. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p>The body function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (__UncopyableClassType__::* __BodyFunctionPointer__)
+ ( __RemoveCopyable__< ArgumentType1 >,
+ ...,
+ __RemoveCopyable__< ArgumentTypeN >
+ ) __MaybeCV__;
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The body function pointer type matches the signature of the contracted function. </p></li>
+<li class="listitem"><p>The <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code> tag is removed from the class and argument types. </p></li>
+<li class="listitem"><p>The function type is the <code class="computeroutput">const</code> only if the contracted function is a constant member.</p></li>
+</ul></div>
+<p>
+The precondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (__UncopyableClassType__::* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type
+ ) const __MaybeVolatile__;
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The precondition function pointer type always has a <code class="computeroutput">void</code> return type. </p></li>
+<li class="listitem"><p>The <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code> tag is removed from the class and argument types. </p></li>
+<li class="listitem"><p>Each function argument is passed as a contract reference. </p></li>
+<li class="listitem"><p>The function type is always <code class="computeroutput">const</code> if the contracted function is a member.</p></li>
+</ul></div>
+<p>
+The postcondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef void (__UncopyableClassType__::* __PreconditionFunctionPointer__)
+ ( __IfCopyable__< ClassType,
+ boost::add_pointer<boost::add_const<
+ ClassType>::type>::type >,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ __IfCopyable__< ArgumentType1,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type >,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type,
+ __IfCopyable__< ArgumentTypeN,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type >,
+ __IfNonVoid__< boost::add_reference<boost::add_const<
+ ResultType>::type>::type >
+ ) const __MaybeVolatile__;
+</pre>
+<p> </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>The postcondition function pointer type always has a <code class="computeroutput">void</code> return type. </p></li>
+<li class="listitem"><p>The <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code> tag is removed from the class and argument types. </p></li>
+<li class="listitem"><p>The first argument is a constant pointer to the object old value if the class type was tagged <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code>, otherwise it is of type <code class="computeroutput">contract::noold</code> (indicating that no object old value is available because the class type was not tagged <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code>). </p></li>
+<li class="listitem"><p>Each function argument is passed as contract reference and it is followed by its old value. Each old value is a constant reference to the argument old value if the argument type was tagged <code class="computeroutput">contract::copayble</code>, otherwise it is of type <code class="computeroutput">contract::noold</code> (indicating that no object old value is available because the argument type was not tagged <code class="computeroutput"><code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code></code>). </p></li>
+<li class="listitem"><p>The function type is always <code class="computeroutput">const</code> if the contracted function is a member. </p></li>
+</ul></div>
+<p>
+</p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id435745-bb"></a><span class="special">~</span><span class="identifier">nonstatic_member_function</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy this contract object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id975705"></a><h3>
+<a name="id435225-bb"></a><code class="computeroutput">nonstatic_member_function</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="identifier">ResultType</span> <a name="id435229-bb"></a><span class="identifier">call</span><span class="special">(</span><span class="identifier">__MaybeCVClassPointer__</span> object<span class="special">,</span> <span class="identifier">ArgumentType1</span> argument1<span class="special">,</span> <span class="special">...</span><span class="special">,</span>
+ <span class="identifier">ArgumetnTypeN</span> argumentN<span class="special">)</span><span class="special">;</span></pre>
+<p>Check the contract and execute the member function body.</p>
+<p>This function implements the correct contract checking semantics for the function call (see the Tutorial section). In summary: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>It checks class invariants and preconditions (also of overridden contracts when subcontracting), it executes the member function body, then it checks class invariants and postconditions (also of overridden contracts when subcontracting). </p></li>
+<li class="listitem"><p>If the body throws an exception, only class invariants (and not postconditions) are checked on function exit. </p></li>
+<li class="listitem"><p>Non-member functions do not check class invariants and they do not subcontract.</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">object</code></strong></span></td>
+<td>A pointer to the object (present only if <code class="computeroutput">F</code> is a member function pointer type). The object pointer is <code class="computeroutput">const</code> only if <code class="computeroutput">F</code> is a constant member function pointer type (to handle constant member functions). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">argument1, ..., argumentN</code></strong></span></td>
+<td>The function arguments. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The function return value but only when <code class="computeroutput">F</code> is a non-void function pointer type.</p>
+<p><span class="bold"><strong>Note:</strong></span> When <code class="computeroutput">F</code> is a member function pointer type, the <code class="computeroutput">call()</code> function checks class invariants by calling a constant member function with the <code class="computeroutput">contract_invariant_</code> predefined name and it also checks static class invariants by calling a static member function with the <code class="computeroutput">contract_static_invariant_</code> predefined name (see the Without the Macros section for more information): </p>
+<pre class="programlisting"> class ClassType {
+
+ #if defined BOOST_CONTRACT_CHECK_INVARIANT
+ void contract_static_invariant_(void) {
+ ... // Assert static class invariants.
+ }
+ void contract_invariant_ (void) const {
+ ... // Assert class invariants.
+ }
+ #endif
+
+ ... // Rest of the class.
+ };
+</pre>
+<p> Note the #if guard to declare the function only when invariant compilation and checking is turned on. Such function must be defined and accessible otherwise the library will generate a compile-time error. Whenever possible, use the <code class="computeroutput">CONTRACT_INVARIANT()</code> macro instead of programming the <code class="computeroutput">contract_invariant_</code> and <code class="computeroutput">contract_static_invariant_</code> functions directly. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nonmember_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonstatic_member_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="copyable.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/postcondition_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/postcondition_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function postcondition_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="set_postcondition_failed.html" title="Function set_postcondition_failed">
+<link rel="next" href="../CONTRACT_ASSERT.html" title="Macro CONTRACT_ASSERT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_postcondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_ASSERT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.postcondition_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function postcondition_failed</span></h2>
+<p>contract::postcondition_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">void</span> <span class="identifier">postcondition_failed</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span> where<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id960624"></a><h2>Description</h2>
+<p>Automatically invoked by this library when a postcondition fails.</p>
+<p>It calls <code class="computeroutput">std::terminate()</code> by default but it can be redefined using <code class="computeroutput">contract::set_postcondition_failed()</code>. When this function is called, the exception raised by the contract failure is the active unhandled exception (which can be re-thrown using <code class="computeroutput">throw</code> and then caught, see Throw on Failure annex).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">where</code></strong></span></td>
+<td>The source that found the the invariant failure. </td>
+</tr></tbody>
+</table></div>
+<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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_postcondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_ASSERT.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/precondition_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/precondition_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function precondition_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="set_precondition_failed.html" title="Function set_precondition_failed">
+<link rel="next" href="set_postcondition_failed.html" title="Function set_postcondition_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_precondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_postcondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.precondition_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function precondition_failed</span></h2>
+<p>contract::precondition_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="keyword">void</span> <span class="identifier">precondition_failed</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span> where<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id960333"></a><h2>Description</h2>
+<p>Automatically invoked by this library when a precondition fails.</p>
+<p>It calls <code class="computeroutput">std::terminate()</code> by default but it can be redefined using <code class="computeroutput">contract::set_precondition_failed()</code>. When this function is called, the exception raised by the contract failure is the active unhandled exception (which can be re-thrown using <code class="computeroutput">throw</code> and then caught, see Throw on Failure annex).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">where</code></strong></span></td>
+<td>The source that found the the invariant failure. </td>
+</tr></tbody>
+</table></div>
+<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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="set_precondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="set_postcondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/set_block_invariant_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/set_block_invariant_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function set_block_invariant_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="contract_failed_handler.html" title="Type definition contract_failed_handler">
+<link rel="next" href="block_invariant_failed.html" title="Function block_invariant_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract_failed_handler.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="block_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.set_block_invariant_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function set_block_invariant_failed</span></h2>
+<p>contract::set_block_invariant_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="identifier">contract_failed_handler</span>
+<span class="identifier">set_block_invariant_failed</span><span class="special">(</span><span class="identifier">contract_failed_handler</span> handler<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id959598"></a><h2>Description</h2>
+<p>Set the specified user defined handler function to call on block invariant failure.</p>
+<p>This function can be used by programmers to specify an action to take in case of block invariant failure different from the default to terminate the program.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">handler</code></strong></span></td>
+<td>A pointer to the new handler function. Passing an invalid pointer, including 0, has undefined behaviour and it will likely result in a segmentation fault. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The previously set handler function pointer.</p>
+<p><span class="bold"><strong>See:</strong></span> Throw on Failure annex for an example. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract_failed_handler.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="block_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/set_class_invariant_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/set_class_invariant_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function set_class_invariant_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="block_invariant_failed.html" title="Function block_invariant_failed">
+<link rel="next" href="class_invariant_failed.html" title="Function class_invariant_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="block_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="class_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.set_class_invariant_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function set_class_invariant_failed</span></h2>
+<p>contract::set_class_invariant_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="identifier">contract_failed_handler</span>
+<span class="identifier">set_class_invariant_failed</span><span class="special">(</span><span class="identifier">contract_failed_handler</span> handler<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id959890"></a><h2>Description</h2>
+<p>Set the specified user defined handler function to call on class invariant failure.</p>
+<p>This function can be used by programmers to specify an action to take in case of class invariant failure different from the default to terminate the program.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">handler</code></strong></span></td>
+<td>A pointer to the new handler function. Passing an invalid pointer, including 0, has undefined behaviour and it will likely result in a segmentation fault. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The previously set handler function pointer.</p>
+<p><span class="bold"><strong>See:</strong></span> Throw on Failure annex for an example. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="block_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="class_invariant_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/set_postcondition_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/set_postcondition_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function set_postcondition_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="precondition_failed.html" title="Function precondition_failed">
+<link rel="next" href="postcondition_failed.html" title="Function postcondition_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="precondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="postcondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.set_postcondition_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function set_postcondition_failed</span></h2>
+<p>contract::set_postcondition_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="identifier">contract_failed_handler</span>
+<span class="identifier">set_postcondition_failed</span><span class="special">(</span><span class="identifier">contract_failed_handler</span> handler<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id960474"></a><h2>Description</h2>
+<p>Set the specified user defined handler function to call on postcondition failure.</p>
+<p>This function can be used by programmers to specify an action to take in case of postcondition failure different from the default to terminate the program.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">handler</code></strong></span></td>
+<td>A pointer to the new handler function. Passing an invalid pointer, including 0, has undefined behaviour and it will likely result in a segmentation fault. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The previously set handler function pointer.</p>
+<p><span class="bold"><strong>See:</strong></span> Throw on Failure annex for an example. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="precondition_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="postcondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/set_precondition_failed.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/set_precondition_failed.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function set_precondition_failed</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">
+<link rel="prev" href="class_invariant_failed.html" title="Function class_invariant_failed">
+<link rel="next" href="precondition_failed.html" title="Function precondition_failed">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="class_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="precondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.set_precondition_failed"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function set_precondition_failed</span></h2>
+<p>contract::set_precondition_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp</a>>
+
+</span>
+<span class="identifier">contract_failed_handler</span>
+<span class="identifier">set_precondition_failed</span><span class="special">(</span><span class="identifier">contract_failed_handler</span> handler<span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id960182"></a><h2>Description</h2>
+<p>Set the specified user defined handler function to call on precondition failure.</p>
+<p>This function can be used by programmers to specify an action to take in case of precondition failure different from the default to terminate the program.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">handler</code></strong></span></td>
+<td>A pointer to the new handler function. Passing an invalid pointer, including 0, has undefined behaviour and it will likely result in a segmentation fault. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Returns:</strong></span> The previously set handler function pointer.</p>
+<p><span class="bold"><strong>See:</strong></span> Throw on Failure annex for an example. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="class_invariant_failed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="precondition_failed.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/state.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/state.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,52 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class state</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.state_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/state.hpp>">
+<link rel="prev" href="../CONTRACT_OLDOF.html" title="Macro CONTRACT_OLDOF">
+<link rel="next" href="static_member_function.html" title="Class template static_member_function">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_OLDOF.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.state_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="static_member_function.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.state"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class state</span></h2>
+<p>contract::state</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.state_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/state.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/state.hpp</a>>
+
+</span>
+<span class="keyword">class</span> <a class="link" href="state.html" title="Class state">state</a> <span class="special">{</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id978831"></a><h2>Description</h2>
+<p>Augmented object state internally used by the library.</p>
+<p>As illustrated by the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> documentation, the class being contracted must declare a (private) member variable named <code class="computeroutput">contract_state_</code> of <code class="computeroutput">mutable</code> type <code class="computeroutput"><a class="link" href="state.html" title="Class state">contract::state</a></code> (see <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> for example code). The type <code class="computeroutput"><a class="link" href="state.html" title="Class state">contract::state</a></code> must be declared a friend of the class. This member variable is automatically declared when the <code class="computeroutput">CONTRACT_INVARIANT()</code> macro is used (recommended).</p>
+<p>This library will generate a compile-time error if this state variable is not declared and accessible to the contracts.</p>
+<p><span class="bold"><strong>Note:</strong></span> This member variable is used internally by this library mainly to track when assertions are being checked so to disable assertion checking in nested function calls that could otherwise lead to infinite recursion (this is a common requirement for Contract Programming). The friendship is requires so the library internally has access to the entire user class including non public members.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code>, Without the Macros section </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_OLDOF.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.state_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="static_member_function.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/static_member_function.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/static_member_function.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,176 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template static_member_function</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.static_member_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/static_member_function.hpp>">
+<link rel="prev" href="state.html" title="Class state">
+<link rel="next" href="wrap.html" title="Struct template wrap">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="state.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.static_member_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="wrap.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.static_member_function"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template static_member_function</span></h2>
+<p>contract::static_member_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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.static_member_function_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/static_member_function.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/static_member_function.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span>
+<span class="keyword">class</span> <a class="link" href="static_member_function.html" title="Class template static_member_function">static_member_function</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// <a class="link" href="static_member_function.html#contract.static_member_functionconstruct-copy-destruct">construct/copy/destruct</a></span>
+ <a class="link" href="static_member_function.html#id436831-bb"><span class="identifier">static_member_function</span></a><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span><span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span><span class="special">)</span><span class="special">;</span>
+ <a class="link" href="static_member_function.html#id437028-bb"><span class="special">~</span><span class="identifier">static_member_function</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
+
+ <span class="comment">// <a class="link" href="static_member_function.html#id436775-bb">public member functions</a></span>
+ <span class="identifier">ResultType</span> <a class="link" href="static_member_function.html#id436779-bb"><span class="identifier">call</span></a><span class="special">(</span><span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id979337"></a><h2>Description</h2>
+<p>Class template used to write contracts for static member functions.</p>
+<p><span class="bold"><strong>Note:</strong></span> Only the differences between this class and the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> class are documented here. Read the <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> documentation first.</p>
+<p>The <code class="computeroutput">CONTRACT_FUNCTION()</code> macro expands to code that uses this class template (when <code class="computeroutput">(static)</code> is specified in the function signature sequence, see the Without the Macros section) -- whenever possible, use the macro instead of using this class template directly. Rarely, it might be needed to use this template class directly to implement workarounds for compilers that do not fully comply with the ISO C++ standard.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">F</code></strong></span></td>
+<td>The function type of the static member function being contracted. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>Base contract classes cannot be specified because static member functions cannot be virtual and they cannot override base virtual functions so they cannot subcontract.</p>
+<p>The function type <code class="computeroutput">F</code> must be specified as follows: </p>
+<pre class="programlisting"> <span class="identifier">ResultType</span> <span class="special">(</span><span class="identifier">ClassType</span><span class="special">*</span><span class="special">,</span> <span class="identifier">ArgumentType1</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumentTypeN</span><span class="special">)</span>
+</pre>
+<p> Note: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p><code class="computeroutput">ClassType</code> is never <code class="computeroutput">const</code> because static member functions cannot be constant member functions (there is no object to not modify). </p></li>
+<li class="listitem"><p><code class="computeroutput">ClassType</code> cannot be tagged <code class="computeroutput"><a class="link" href="copyable.html" title="Class template copyable">contract::copyable</a></code> because there is no object for static member functions -- the library will generate a compile-time error otherwise.</p></li>
+</ul></div>
+<p>
+<span class="bold"><strong>See:</strong></span> Without the Macros section, <code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code> </p>
+<div class="refsect2">
+<a name="id979582"></a><h3>
+<a name="contract.static_member_functionconstruct-copy-destruct"></a><code class="computeroutput">static_member_function</code>
+ public
+ construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><a name="id436831-bb"></a><span class="identifier">static_member_function</span><span class="special">(</span><span class="identifier">__BodyFunctionPointer__</span> body_function<span class="special">,</span>
+ <span class="identifier">__PreconditionFunctionPointer__</span> precondition_function<span class="special">,</span>
+ <span class="identifier">__PostconditionFunctionPointer__</span> postcondition_function<span class="special">)</span><span class="special">;</span></pre>
+<p>Construct this contract object using the specified body, preconditions, and postconditions functions.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">body_function</code></strong></span></td>
+<td>A pointer to the function executing the body. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">precondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the preconditions. </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">postcondition_function</code></strong></span></td>
+<td>A pointer to the function asserting the postconditions. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation for the definition of metaprogramming constructs used below (<code class="computeroutput">__IfCopyable__</code>, etc).</p>
+<p>Note the followings for the function pointer types defined below: </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem"><p>They are static member functions (they do not specify the class type as in <code class="computeroutput">(ClassType::*)</code> but only the function pointer <code class="computeroutput">(*)</code>). </p></li>
+<li class="listitem"><p>They are never <code class="computeroutput">const</code> member functions because they are <code class="computeroutput">static</code>. </p></li>
+<li class="listitem"><p>There is no old object value in postconditions, not even <code class="computeroutput">contract::noold</code> (because static member functions have no object).</p></li>
+</ul></div>
+<p>
+The body function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __BodyFunctionPointer__)
+ ( __RemoveCopyable__< ArgumentType1 >,
+ ...,
+ __RemoveCopyable__< ArgumentTypeN >
+ );
+</pre>
+<p>The precondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type
+ );
+</pre>
+<p>The postcondition function pointer type is defined as follows: </p>
+<pre class="programlisting"> typedef ResultType (* __PreconditionFunctionPointer__)
+ ( boost::add_reference<boost::add_const<
+ __RemoveCopyable< ArgumentType1 > >::type>::type,
+ __IfCopyable__< ArgumentType1,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentType1 > >::type>::type >,
+ ...,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable__< ArgumentTypeN > >::type>::type,
+ __IfCopyable__< ArgumentTypeN,
+ boost::add_reference<boost::add_const<
+ __RemoveCopyable< ArgumentTypeN > >::type>::type >,
+ __IfNonVoid__< boost::add_reference<boost::add_const<
+ ResultType>::type>::type >
+ );
+</pre>
+<p> </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><a name="id437028-bb"></a><span class="special">~</span><span class="identifier">static_member_function</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
+<p>Destroy this contract object. </p>
+</li>
+</ol></div>
+</div>
+<div class="refsect2">
+<a name="id979928"></a><h3>
+<a name="id436775-bb"></a><code class="computeroutput">static_member_function</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><span class="identifier">ResultType</span> <a name="id436779-bb"></a><span class="identifier">call</span><span class="special">(</span><span class="identifier">ArgumentType1</span> argument1<span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">ArgumetnTypeN</span> argumentN<span class="special">)</span><span class="special">;</span></pre>
+<p>Check the contract and executes the member function body.</p>
+<p>Refer to the <code class="computeroutput"><code class="computeroutput"><a class="link" href="nonstatic_member_function.html" title="Class template nonstatic_member_function">contract::nonstatic_member_function</a></code></code> documentation.</p>
+<p>The <code class="computeroutput">call()</code> function takes no object (because the contracted function is static). </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="state.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.static_member_function_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="wrap.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="static_member_function.html" title="Class template static_member_function">
+<link rel="next" href="wrap_void_T__id437104.html" title="Struct template wrap<void(T)>">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="static_member_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="wrap_void_T__id437104.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap</span></h2>
+<p>contract::wrap</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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap.html" title="Struct template wrap">wrap</a> <span class="special">{</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980332"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p><span class="bold"><strong>Warning:</strong></span> Attempting to use this template directly will generate a compile-time error. Only the template specialization <code class="computeroutput"><a class="link" href="wrap.html" title="Struct template wrap">contract::wrap</a><void(T)></code> can be used.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="wrap.html" title="Struct template wrap">contract::wrap</a><void(T)></code> specialization, <code class="computeroutput">CONTRACT_WRAP_TYPE()</code> </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="static_member_function.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="wrap_void_T__id437104.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id2358596.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id2358596.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,75 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
+<link rel="start" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header..home.lcaminiti.sandbox.dbcpp_sourceforge.boost-quickbook.doc.qbk.src.contract.wrap_hpp" title="Header <contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src=".././doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header..home.lcaminiti.sandbox.dbcpp_sourceforge.boost-quickbook.doc.qbk.src.contract.wrap_hpp"><img src=".././doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src=".././doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src=".././doc/html/images/next.png" alt="Next"></a>
+</div>
+<hr>
+<div class="refentry" lang="en">
+<a name="contract.wrap_void(T)_id2358596"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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="emphasis"><em>// In header: <<a class="link" href="../reference.html#header..home.lcaminiti.sandbox.dbcpp_sourceforge.boost-quickbook.doc.qbk.src.contract.wrap_hpp" title="Header <contract/wrap.hpp>">contract/wrap.hpp</a>>
+
+</em></span><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T>
+<span class="bold"><strong>struct</strong></span> <a class="link" href="wrap_void_T__id2358596.html" title="Struct template wrap<void(T)>">wrap</a><<span class="bold"><strong>void</strong></span>(T)> {
+ <span class="emphasis"><em>// <a class="link" href="wrap_void_T__id2358596.html#contract.wrap_void(T)_id2358596types">types</a></em></span>
+ <span class="bold"><strong>typedef</strong></span> T <a class="link" href="wrap_void_T__id2358596.html#contract.wrap_void(T)_id2358596.type">type</a>;
+};</pre></div>
+<div class="refsect1" lang="en">
+<a name="id2670329"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2" lang="en">
+<a name="id2670413"></a><h3>
+<a name="contract.wrap_void(T)_id2358596types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol type="1"><li>
+<p>
+<span class="bold"><strong>typedef</strong></span> T <a name="contract.wrap_void(T)_id2358596.type"></a>type;</p>
+<p>The type T. </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 © 2009 -2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src=".././doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header..home.lcaminiti.sandbox.dbcpp_sourceforge.boost-quickbook.doc.qbk.src.contract.wrap_hpp"><img src=".././doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src=".././doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src=".././doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436550.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436550.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436550"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436550.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436550.html#contract.wrap_void(T)_id436550types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436550.html#contract.wrap_void(T)_id436550.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980042"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980134"></a><h3>
+<a name="contract.wrap_void(T)_id436550types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436550.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436560.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436560.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436560"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436560.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436560.html#contract.wrap_void(T)_id436560types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436560.html#contract.wrap_void(T)_id436560.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id979985"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980077"></a><h3>
+<a name="contract.wrap_void(T)_id436560types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436560.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436562.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436562.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436562"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436562.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436562.html#contract.wrap_void(T)_id436562types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436562.html#contract.wrap_void(T)_id436562.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980000"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980091"></a><h3>
+<a name="contract.wrap_void(T)_id436562types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436562.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436565.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436565.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436565"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436565.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436565.html#contract.wrap_void(T)_id436565types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436565.html#contract.wrap_void(T)_id436565.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id979999"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980090"></a><h3>
+<a name="contract.wrap_void(T)_id436565types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436565.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436578.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436578.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436578"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436578.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436578.html#contract.wrap_void(T)_id436578types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436578.html#contract.wrap_void(T)_id436578.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980054"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980146"></a><h3>
+<a name="contract.wrap_void(T)_id436578types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436578.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436755.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436755.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436755"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436755.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436755.html#contract.wrap_void(T)_id436755types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436755.html#contract.wrap_void(T)_id436755.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980214"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980305"></a><h3>
+<a name="contract.wrap_void(T)_id436755types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436755.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436782.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id436782.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id436782"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id436782.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id436782.html#contract.wrap_void(T)_id436782types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id436782.html#contract.wrap_void(T)_id436782.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980274"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980365"></a><h3>
+<a name="contract.wrap_void(T)_id436782types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id436782.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437043.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437043.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437043"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437043.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437043.html#contract.wrap_void(T)_id437043types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437043.html#contract.wrap_void(T)_id437043.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980519"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980611"></a><h3>
+<a name="contract.wrap_void(T)_id437043types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437043.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437088.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437088.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437088"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437088.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437088.html#contract.wrap_void(T)_id437088types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437088.html#contract.wrap_void(T)_id437088.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980523"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980614"></a><h3>
+<a name="contract.wrap_void(T)_id437088types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437088.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437104.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437104.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437104"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437104.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437104.html#contract.wrap_void(T)_id437104types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437104.html#contract.wrap_void(T)_id437104.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980562"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980653"></a><h3>
+<a name="contract.wrap_void(T)_id437104types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437104.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437106.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437106.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437106"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437106.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437106.html#contract.wrap_void(T)_id437106types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437106.html#contract.wrap_void(T)_id437106.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980504"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980596"></a><h3>
+<a name="contract.wrap_void(T)_id437106types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437106.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437311.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437311.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437311"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437311.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437311.html#contract.wrap_void(T)_id437311types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437311.html#contract.wrap_void(T)_id437311.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980786"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980878"></a><h3>
+<a name="contract.wrap_void(T)_id437311types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437311.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437382.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437382.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437382"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437382.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437382.html#contract.wrap_void(T)_id437382types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437382.html#contract.wrap_void(T)_id437382.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id980786"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id980878"></a><h3>
+<a name="contract.wrap_void(T)_id437382types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437382.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437642.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id437642.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id437642"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id437642.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id437642.html#contract.wrap_void(T)_id437642types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id437642.html#contract.wrap_void(T)_id437642.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id981050"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id981142"></a><h3>
+<a name="contract.wrap_void(T)_id437642types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id437642.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439377.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439377.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id439377"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id439377.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id439377.html#contract.wrap_void(T)_id439377types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id439377.html#contract.wrap_void(T)_id439377.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id982642"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id982734"></a><h3>
+<a name="contract.wrap_void(T)_id439377types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id439377.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439703.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract/wrap_void_T__id439703.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Struct template wrap<void(T)></title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">
+<link rel="prev" href="wrap.html" title="Struct template wrap">
+<link rel="next" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="contract.wrap_void(T)_id439703"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Struct template wrap<void(T)></span></h2>
+<p>contract::wrap<void(T)></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.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp" title="Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp>">E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp</a>>
+
+</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span>
+<span class="keyword">struct</span> <a class="link" href="wrap_void_T__id439703.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
+ <span class="comment">// <a class="link" href="wrap_void_T__id439703.html#contract.wrap_void(T)_id439703types">types</a></span>
+ <span class="keyword">typedef</span> <span class="identifier">T</span> <a class="link" href="wrap_void_T__id439703.html#contract.wrap_void(T)_id439703.type"><span class="identifier">type</span></a><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id983092"></a><h2>Description</h2>
+<p>Metafunction used to wrap type expressions containing commas so they can be passed as macro parameters.</p>
+<p>This metafunction first wrap the specified type <code class="computeroutput">T</code> within parenthesis <code class="computeroutput"></code>() (so <code class="computeroutput">T</code> can be passed as a single macro parameter even if it contains commas) forming a void-function type with one argument of type <code class="computeroutput">T</code>. Then the application of the metafunction via its member <code class="computeroutput">type</code> returns the wrapped type <code class="computeroutput">T</code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">T</code></strong></span></td>
+<td>Type to be wrapped so it can be passed within a macro parameter even if it contains commas. </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>See:</strong></span> CONTRACT_WRAP_TYPE() for more explanation and examples </p>
+<div class="refsect2">
+<a name="id983184"></a><h3>
+<a name="contract.wrap_void(T)_id439703types"></a><code class="computeroutput">wrap</code>
+ public
+ types</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<p>
+<span class="keyword">typedef</span> <span class="identifier">T</span> <a name="contract.wrap_void(T)_id439703.type"></a><span class="identifier">type</span><span class="special">;</span></p>
+<p>The type T. </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="wrap.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/Rationale.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/Rationale.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,149 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Annex: Rationale</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="../CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">
+<link rel="next" href="bibliography.html" title="Bibliography">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="bibliography.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.Rationale"></a><a class="link" href="Rationale.html" title="Annex: Rationale">Annex: Rationale</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="Rationale.html#contract__.Rationale.why_is_the_body_not_passed_as_a_macro_parameter_">Why
+ is the body not passed as a macro parameter?</a></span></dt>
+<dt><span class="section"><a href="Rationale.html#contract__.Rationale.why_the_contract_macros_need_all_class_and_function_signature_elements_">Why
+ the contract macros need all class and function signature elements?</a></span></dt>
+<dt><span class="section"><a href="Rationale.html#contract__.Rationale.why_exception_specifications_are_passed_as_a_macro_parameter___throw________">Why
+ exception specifications are passed as a macro parameter <code class="computeroutput"><span class="special">(</span><span class="keyword">throw</span><span class="special">)(...)</span></code>?</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Rationale.why_is_the_body_not_passed_as_a_macro_parameter_"></a><a class="link" href="Rationale.html#contract__.Rationale.why_is_the_body_not_passed_as_a_macro_parameter_" title="Why is the body not passed as a macro parameter?">Why
+ is the body not passed as a macro parameter?</a>
+</h3></div></div></div>
+<p>
+ The function, constructor, and destructor definition body is not passed as
+ a macro parameter because macros always expand on a single line. Therefore,
+ if the body was passed as a macro parameter and part of the macro expansion,
+ it would expand on a single line and eventual compiler error referring to
+ code within the body will all have the same line number making it very difficult
+ to pinpoint the error.
+ </p>
+<p>
+ The downside of keeping the body outside the macro expansion is that the
+ additional body function defined to wrap the body will have the same access
+ level as the function being contracted. Therefore, if the function being
+ contracted is not private, the body function will also be not private. However,
+ this is an acceptable limitation because the body function, even if public
+ or protected, will have a special named prefix <code class="computeroutput"><span class="identifier">contract_body_</span><span class="special">...</span></code> indicating that it is part of this library
+ private API and should never be used directly by programmers.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Rationale.why_the_contract_macros_need_all_class_and_function_signature_elements_"></a><a class="link" href="Rationale.html#contract__.Rationale.why_the_contract_macros_need_all_class_and_function_signature_elements_" title="Why the contract macros need all class and function signature elements?">Why
+ the contract macros need all class and function signature elements?</a>
+</h3></div></div></div>
+<p>
+ Even if we do not consider implementation details of this library, a large
+ set of attributes of the declaration signature of classes and function is
+ needed to program contracts. For example: * The class is needed to access
+ the object <code class="computeroutput"><span class="keyword">this</span></code>. * Base classes
+ are needed to automatically support subcontracting. Furthermore, the base
+ class access level is needed because subcontracting could in principle be
+ relaxed for private and protected base classes (this was suggested by A++
+ but the current implementation of the library decided to follow N1962 and
+ not to relax subcontracting for non-public functions). Also to automatically
+ support subcontracting, the function contract macros needed to know if a
+ function if virtual or not (this allows to defined special types for virtual
+ function in the base classes so they can be automatically detected by derived
+ classes via introspection metaprogramming techniques using SFINAE). * The
+ member function access level is needed because class invariants are only
+ checked for public functions. * The static classifier of member functions
+ is needed because static member functions do not check non-static class invariants.
+ * Function parameter types and names are needed because they are need to
+ be passed to the functions checking the preconditions and postconditions.
+ Furthermore, the parameter type needs to be specified separately from the
+ parameter name because the <code class="computeroutput"><span class="keyword">const</span></code>
+ qualifier needs to be added to the type so preconditions and postconditions
+ access parameters only in a constant-correct context. Finally, the parameter
+ names are used to emulate function overloading (i.e., functions with same
+ name can have separate contracts as long as they have different parameter
+ names). * The function result type is needed so the result value can be accessed
+ by postconditions for non-void functions. * Template parameters are needed
+ to check contracts.
+ </p>
+<p>
+ Given the large number of signature attributes that are needed to specify
+ contracts, the parenthesized signature was used so the library has access
+ to all the attributes of the signature. Furthermore, to avoid duplicating
+ the signature attributes (which would require programmers to duplicate code
+ making both development and manteinace more tedius), all the attributes are
+ specified within the macros so the macros can also generated the class and
+ function signature automatically.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Rationale.why_exception_specifications_are_passed_as_a_macro_parameter___throw________"></a><a class="link" href="Rationale.html#contract__.Rationale.why_exception_specifications_are_passed_as_a_macro_parameter___throw________" title="Why exception specifications are passed as a macro parameter (throw)(...)?">Why
+ exception specifications are passed as a macro parameter <code class="computeroutput"><span class="special">(</span><span class="keyword">throw</span><span class="special">)(...)</span></code>?</a>
+</h3></div></div></div>
+<p>
+ Exception specifications cannot simply be programmed outside the contract
+ macros before the body is specified as:
+ </p>
+<pre class="programlisting"><span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">)</span> <span class="keyword">throw</span><span class="special">()</span> <span class="special">{</span>
+ <span class="special">...</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Because this way the exception specification only apply to the body function
+ and the macro expansion cannot apply them to the actual function:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">()</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Check preconditions.</span>
+ <span class="identifier">f_body</span><span class="special">();</span> <span class="comment">// Execute body.</span>
+ <span class="special">...</span> <span class="comment">// Check postconditions.</span>
+<span class="special">}</span>
+<span class="special">...</span>
+<span class="keyword">void</span> <span class="identifier">f_body</span><span class="special">()</span> <span class="keyword">throw</span><span class="special">()</span> <span class="special">{</span>
+ <span class="special">...</span>
+<span class="special">}</span>
+</pre>
+<p>
+ So if for some reason the precondition or postcondition (or invariant, or
+ any other code of this library) throws an exception, the function <code class="computeroutput"><span class="identifier">f</span><span class="special">()</span></code> will
+ still throw that exception not complying with the exception specification.
+ </p>
+<p>
+ Therefore, the exception specification are passed as a macro parameter (complicating
+ the parenthesized syntax a bit) so they can applied by the macro expansion
+ to the outer most function <code class="computeroutput"><span class="identifier">f</span><span class="special">()</span></code> and not just to its body function.
+ </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../CONTRACT_WRAP_TYPE.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="bibliography.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/bibliography.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/bibliography.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,136 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Bibliography</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="Rationale.html" title="Annex: Rationale">
+<link rel="next" href="license.html" title="License">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="Rationale.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="license.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.bibliography"></a><a class="link" href="bibliography.html" title="Bibliography">Bibliography</a>
+</h2></div></div></div>
+<p>
+ [Abrahams2005] D. Abrahams, L. Crowl, T. Ottosen, and J. Widman. <span class="emphasis"><em>Proposal
+ to add Contract Programming to C++ (revision 2).</em></span> The C++ Standards
+ Committee, n1773,
+ 2005.
+ </p>
+<p>
+ [Bright2004] W. Bright. <a href="http://www.digitalmars.com/d/2.0/dbc.html" target="_top"><span class="emphasis"><em>Contract
+ Programming for the D Programming Language.</em></span></a> 2004.
+ </p>
+<p>
+ [Bright2004b] W. Bright. <a href="http://www.digitalmars.com/ctg/contract.html" target="_top"><span class="emphasis"><em>Contract
+ Programming for the Digital Mars C++ Compiler.</em></span></a> 2004.
+ </p>
+<p>
+ [C^2] Aechmea. <a href="http://www.programmersheaven.com/app/news/DisplayNews.aspx?NewsID=3843" target="_top"><span class="emphasis"><em>C^2
+ Contract Programming add-on for C++.</em></span></a> 2005.
+ </p>
+<p>
+ [Chrome2002] RemObjects. <a href="http://blogs.remobjects.com/blogs/mh/2008/05/01/p216" target="_top"><span class="emphasis"><em>Chromes:
+ Contract Programming for Object Pascal in .NET.</em></span></a> 2002.
+ </p>
+<p>
+ [Cline1990] M. Cline and D. Lea. "The Behaviour of C++ Classes" and
+ "Using Annotated C++". <span class="emphasis"><em>Proc. of the Symposium on Object
+ Oriented Programming Emphasizing Practical Applications</em></span>, Maris College,
+ 19090.
+ </p>
+<p>
+ [Crowl2005] L. Crowl and T. Ottosen. <span class="emphasis"><em>Proposal to add Contract Programming
+ to C++ (revision 3).</em></span> The C++ Standards Committee, n1866,
+ 2005.
+ </p>
+<p>
+ [Crowl2006] L. Crowl and T. Ottosen. <span class="emphasis"><em>Proposal to add Contract Programming
+ to C++ (revision 4).</em></span> The C++ Standards Committee, n1962,
+ 2006.
+ </p>
+<p>
+ [iContract] O. Enseling. <a href="http://www.javaworld.com/javaworld/jw-02-2001/jw-0216-cooltools.html" target="_top"><span class="emphasis"><em>iContract:
+ Contract Programming for Java.</em></span></a> 2001.
+ </p>
+<p>
+ [Jcontract] Parasoft. <a href="http://www.parasoft.com/jsp/products/article.jsp?label=product_info_Jcontract" target="_top"><span class="emphasis"><em>Jcontract:
+ Contract Programming for Java.</em></span></a>
+ </p>
+<p>
+ [Maley1999] D. Maley and I. Spence. <a href="http://www.computer.org/portal/web/csdl/doi/10.1109/TOOLS.1999.779000" target="_top"><span class="emphasis"><em>Emulating
+ Design by Contract in C++.</em></span></a> Proceedings of TOOLS, IEEE Computer
+ Society, 1999.
+ </p>
+<p>
+ [Meyer1997] B. Meyer. <span class="emphasis"><em>Object Oriented Software Construction.</em></span>
+ Prentice-Hall, 2nd edition, 1997.
+ </p>
+<p>
+ [Mitchell2002] R. Mitchell and J. McKim. <span class="emphasis"><em>Design by Contract, by Example.</em></span>
+ Addison-Wesley, 2002.
+ </p>
+<p>
+ [Nelson2004] C. Nelson. <span class="emphasis"><em>Working draft changes for C99 preprocessor
+ synchronization.</em></span> C++ Standards Committee n1653,
+ 2004.
+ </p>
+<p>
+ [Ottosen2004] T. Ottosen. <span class="emphasis"><em>Proposal to add Design by Contract to C++.</em></span>
+ The C++ Standards Committee, n1613,
+ 2004.
+ </p>
+<p>
+ [Ottosen2004b] T. Ottosen. <span class="emphasis"><em>Proposal to add Contract Programming to
+ C++ (revision 1).</em></span> The C++ Standards Committee, n1669,
+ 2004.
+ </p>
+<p>
+ [SPARKAda] Praxis. <a href="http://www.praxis-his.com/sparkada/language.asp" target="_top"><span class="emphasis"><em>SPARKAda
+ (Ada-like Language with Contract Programming).</em></span></a>
+ </p>
+<p>
+ [Spec#] Microsoft. <a href="http:://research.microsoft.com/en-us/projects/specsharp/" target="_top"><span class="emphasis"><em>Spec#
+ (C# Extension).</em></span></a>
+ </p>
+<p>
+ [Stroustrup1997] B. Stroustrup. <span class="emphasis"><em>The C++ Programming Language.</em></span>
+ Prentice-Hall, 2nd Edition, 1997
+ </p>
+<p>
+ [Sutter2005] H. Sutter and F. Glassborow. <span class="emphasis"><em>Delegating Constructors,
+ revision 2.</em></span> C++ Standards Committee, n1895,
+ 2005.
+ </p>
+<p>
+ [Tandin2004] A. Tandin. <a href="http://www.codeproject.com/KB/macros/DbC_and_Doxygen.aspx" target="_top"><span class="emphasis"><em>Design
+ by Contract macros for C++ and link to Doxygen.</em></span></a> 2004.
+ </p>
+<p>
+ [Wilson2006] M. Wilson. <span class="emphasis"><em>Contract Programming 101 -- The Nuclear Reactor
+ and the Deep Space Probe.</em></span> <a href="http://www.artima.com/cppsource/deepspace.html" target="_top">The
+ C++ Source</a>, 2006.
+ </p>
+</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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="Rationale.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="license.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/contract_programming.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/contract_programming.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,886 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Annex: Contract Programming</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="throw_on_failure.html" title="Annex: Throw on Failure">
+<link rel="next" href="Grammar.html" title="Appendix: Grammar">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="throw_on_failure.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="Grammar.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.contract_programming"></a><a class="link" href="contract_programming.html" title="Annex: Contract Programming">Annex: Contract Programming</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Features</span></dt>
+<dt><span class="section">Requirements</span></dt>
+<dt><span class="section">Benefits</span></dt>
+<dt><span class="section">Costs</span></dt>
+<dt><span class="section">Other Tools</span></dt>
+</dl></div>
+<p>
+ This section continues the discussion on Contract Programming started in <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview" title="Contract Programming Overview">Contract Programming
+ Overview</a>.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.contract_programming.features"></a><a class="link" href="contract_programming.html#contract__.contract_programming.features" title="Features">Features</a>
+</h3></div></div></div>
+<p>
+ The following table compares features between this library, the proposal
+ for adding Contract Programming to the C++ standard <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ (see also <a class="link" href="bibliography.html" title="Bibliography">[Crowl2005]</a>, <a class="link" href="bibliography.html" title="Bibliography">[Abrahams2005]</a>, <a class="link" href="bibliography.html" title="Bibliography">[Ottosen2004b]</a>,
+ and <a class="link" href="bibliography.html" title="Bibliography">[Ottosen2004]</a>) <sup>[<a name="id950232" href="#ftn.id950232" class="footnote">19</a>]</sup> , the Eiffel programming language <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>,
+ and the D programming language <a class="link" href="bibliography.html" title="Bibliography">[Bright2004]</a>.
+ </p>
+<div class="table">
+<a name="id950262"></a><p class="title"><b>Table 1. Contract Programming Feature Comparison</b></p>
+<div class="table-contents"><table class="table" summary="Contract Programming Feature Comparison">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Feature
+ </p>
+ </th>
+<th>
+ <p>
+ This Library
+ </p>
+ </th>
+<th>
+ <p>
+ C++ Standard Proposal
+ </p>
+ </th>
+<th>
+ <p>
+ ISE Eiffel 5.4
+ </p>
+ </th>
+<th>
+ <p>
+ D
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Keywords</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ In contract macros preprocessor sequence: <code class="literal">(precondition)</code>,
+ <code class="literal">(postcondition)</code>, <code class="literal">(body)</code>,
+ <code class="literal">(copyable)</code>, <code class="literal">(inherit)</code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">invariant</code>, <code class="literal">precondition</code>,
+ <code class="literal">postcondition</code>, <code class="literal">oldof</code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">invariant</code>, <code class="literal">require</code>, <code class="literal">ensure</code>,
+ <code class="literal">do</code>, <code class="literal">require else</code>, <code class="literal">ensure
+ then</code>, <code class="literal">old</code>, <code class="literal">result</code>,
+ <code class="literal">variant</code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">invariant</code>, <code class="literal">in</code>, <code class="literal">out</code>,
+ <code class="literal">assert</code>, <code class="literal">static</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>On contract failure</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Default to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code> but can be customized (might
+ throw)
+ </p>
+ </td>
+<td>
+ <p>
+ Default to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code> but can be customized (might
+ throw)
+ </p>
+ </td>
+<td>
+ <p>
+ Throw exception
+ </p>
+ </td>
+<td>
+ <p>
+ Throw exception
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Return value in postconditions</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">(postcondition)(</code><span class="emphasis"><em>result-name</em></span><code class="literal">)</code>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">postcondition (</code><span class="emphasis"><em>result-name</em></span><code class="literal">)</code>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">result</code> keyword
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Old values in postconditions</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">CONTRACT_OLDOF(</code><span class="emphasis"><em>name</em></span><code class="literal">)</code>
+ (but only for class and argument types tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span></code>)
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">oldof</code> keyword
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">old</code> keyword
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Subcontracting</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, also support multiple base contracts for multiple inheritance
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, also support multiple base contracts but only base classes
+ can specify preconditions
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Contracts for abstract functions</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ No (planned)
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Arbitrary code in contracts</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes (but recommended to limit contracts to a list of assertions
+ <code class="literal">CONTRACT_ASSERT()</code> and to use only public members
+ in preconditions)
+ </p>
+ </td>
+<td>
+ <p>
+ No, assertions only
+ </p>
+ </td>
+<td>
+ <p>
+ No, assertions only plus preconditions can only access public members
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Constant-correct</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Function code ordering</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ In contract macros preprocessor sequence: Preconditions -> postconditions
+ -> body
+ </p>
+ </td>
+<td>
+ <p>
+ Preconditions, postconditions, body
+ </p>
+ </td>
+<td>
+ <p>
+ Preconditions, body, postconditions
+ </p>
+ </td>
+<td>
+ <p>
+ Preconditions, postconditions, body
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Static assertions</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ No (but Boost.MPL
+ can be used within contracts)
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Block invariants</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">CONTRACT_ASSERT_BLOCK_INVARIANT()</code>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">invariant</code>
+ </p>
+ </td>
+<td>
+ <p>
+ No, but support loop invariants (loops are special code blocks
+ that iterate)
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Loop variants</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, <code class="literal">CONTRACT_ASSERT_LOOP_VARIANT()</code> and <code class="literal">CONTRACT_INIT_LOOP_VARIANT</code>
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Disable assertion checking within assertions checking
+ (policy)</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes (to prevent infinite recursion)
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, but not in preconditions
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Nested function calls (policy)</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Disable checking of class invariants (static and non)
+ </p>
+ </td>
+<td>
+ <p>
+ Disable nothing
+ </p>
+ </td>
+<td>
+ <p>
+ Disable all checks
+ </p>
+ </td>
+<td>
+ <p>
+ Disable nothing
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Non-static class invariants checking (policy)</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ At constructor exit, around any non-static function, at destructor
+ entry, and at function exit due to exception -- but only if programmers
+ specifies contracts for those (e.g., if no contract specified for
+ a private function then no class invariant and no contract is checked
+ for that function)
+ </p>
+ </td>
+<td>
+ <p>
+ At constructor exit, around public functions, at destructor entry,
+ and at function exit due to exception
+ </p>
+ </td>
+<td>
+ <p>
+ At constructor exit, and around public functions
+ </p>
+ </td>
+<td>
+ <p>
+ At constructor exit, around public functions, and at destructor
+ entry
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Static class invariants checking (policy)</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ At entry and exit of any (also static) member function, constructor,
+ and destructor
+ </p>
+ </td>
+<td>
+ <p>
+ No static class invariants
+ </p>
+ </td>
+<td>
+ <p>
+ No static class invariants
+ </p>
+ </td>
+<td>
+ <p>
+ No static class invariants
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <span class="emphasis"><em>Removable from object code</em></span>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes, any combinations of <code class="computeroutput"><span class="identifier">CONTRACT_CHECK_BLOCK_INVARIANT</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_CHECK_PRECONDITION</span></code>,
+ and <code class="computeroutput"><span class="identifier">CONTRACT_CHECK_POSTCONDITION</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ <p>
+ Yes (but predefined combinations only)
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<br class="table-break">
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.contract_programming.requirements"></a><a class="link" href="contract_programming.html#contract__.contract_programming.requirements" title="Requirements">Requirements</a>
+</h3></div></div></div>
+<p>
+ The design of this library was largely based on the requirements identified
+ by the different revisions of the proposal for adding Contract Programming
+ to the C++ standard <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006, etc]</a>
+ and by the Eiffel programming language <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>.
+ </p>
+<p>
+ This is a list of some of the specific requirements considered for the library
+ design:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Implement Contract Programming within ISO standard C++ (without using
+ external preprcessing tools, etc).
+ </li>
+<li class="listitem">
+ Support optional contract compilation and checking. Programmers can select
+ any combination among invariants, preconditions, and postconditions to
+ be compiled and checked (e.g., compile and check invariants and postconditions
+ only).
+ </li>
+<li class="listitem">
+ Programmers can decide the action to take on contract failure.
+ </li>
+<li class="listitem">
+ Programmers can completely remove contract code for compilation. In other
+ words, if no invariants, no preconditions, and no postconditions are
+ compiled and checked then the user code should remain unchanged (for
+ object size, execution time, compilation-time, etc).
+ </li>
+<li class="listitem">
+ Support old values in postconditions for copyable types. Plus allow programmers
+ to remove the extra copy overhead even for copyable types if the old
+ value is not needed in postconditions (e.g., by not specifying the type
+ copyable).
+ </li>
+<li class="listitem">
+ Support result value in postconditions.
+ </li>
+<li class="listitem">
+ Support subcontracting with multiple inheritance.
+ </li>
+<li class="listitem">
+ Enforce contract constant-correctness at compile-time.
+ </li>
+<li class="listitem">
+ Do not alter the user code public API.
+ </li>
+<li class="listitem">
+ Support contract for all C++ constructs (operators, template class, template
+ functions, static members, non-members, non-static members, constructors,
+ destructors, pure virtual members, etc).
+ </li>
+<li class="listitem">
+ Program contracts together with function and class declarations (not
+ definitions) because contracts are part of the specifications.
+ </li>
+<li class="listitem">
+ Support contract when function (body) definition is separated from (contract)
+ declaration.
+ </li>
+<li class="listitem">
+ Support block invariants.
+ </li>
+<li class="listitem">
+ Support loop variants and invariants.
+ </li>
+</ol></div>
+<p>
+ In addition, library early implementations were somewhat inspired by the
+ work of <a class="link" href="bibliography.html" title="Bibliography">[Maley1999]</a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.contract_programming.benefits"></a><a class="link" href="contract_programming.html#contract__.contract_programming.benefits" title="Benefits">Benefits</a>
+</h3></div></div></div>
+<p>
+ The main use of Contract Programming is to improve software quality. <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a> discusses how Contract
+ Programming can be used as the basic tool to write "correct" software.
+ The following is a short summary of the benefits associated with Contract
+ Programming mainly taken from <a class="link" href="bibliography.html" title="Bibliography">[Ottosen2004]</a>.
+ See also <a class="link" href="bibliography.html" title="Bibliography">[Wilson2006]</a> for
+ a discussion of Contract Programming applied to the C++ programming language.
+ Furhtermore, <a class="link" href="bibliography.html" title="Bibliography">[Stroustrup1997]</a>
+ discusses the key importance of class invariants plus advantages and disadvantages
+ of using preconditions and postconditions.
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ 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 member function. Finally,
+ the destructor makes sure that the class invariants hold for the entire
+ object life-cycle checking the class invariants one last time before
+ destroying the object.
+ </li>
+<li class="listitem">
+ Using function preconditions and postconditions, programmers can give
+ a precise semantic description of what a function requires at its entry
+ and what it ensures under its (normal) exit. In particular, using the
+ old value in postconditions, Contract Programming provides a mechanism
+ that allows programmers to compare values of an expression before and
+ after the executions of the function body. This mechanism is powerful
+ enough to enable programmers to express many constraints within the code
+ -- constraints that would otherwise have to be captured at the best only
+ informally by the code documentation.
+ </li>
+<li class="listitem">
+ Because contracts are embedded directly into the source code, they are
+ executed and verified at run-time so they are always up to date with
+ the code itself. Therefore the specifications as documented by the contracts
+ can be trusted to always be up to date with the source code itself.
+ </li>
+<li class="listitem">
+ 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 that in some later
+ stage of the program in an apparently unrelated manner. In general, a
+ precondition failure points to a bug in the function caller. A postcondition
+ failure points instead to a bug in the function implementation. Furthermore,
+ in case of contract failure, this library provides detailed error messages
+ that greatly helps debugging. <sup>[<a name="id951869" href="#ftn.id951869" class="footnote">20</a>]</sup>
+ </li>
+<li class="listitem">
+ 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 inputs cause it to exit normally.
+ </li>
+<li class="listitem">
+ Contract Programming can serve to reduce the gap between designers and
+ programmers by providing a precise and unambiguous specification language.
+ Moreover, contracts can make code reviews easier.
+ </li>
+<li class="listitem">
+ Contract Programming formalizes the virtual function overriding mechanism
+ via the concept of subcontracting. This keeps the base class programmers
+ in control as overriding functions still have to fully satisfy the base
+ class contracts.
+ </li>
+<li class="listitem">
+ Contract Programming assertions can replace <span class="emphasis"><em>defensive programming</em></span>
+ checks localizing these checks within the contract and making the code
+ more readable.
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.contract_programming.costs"></a><a class="link" href="contract_programming.html#contract__.contract_programming.costs" title="Costs">Costs</a>
+</h3></div></div></div>
+<p>
+ Contract Programming benefits come to the cost of performance as discussed
+ in detail by both <a class="link" href="bibliography.html" title="Bibliography">[Stroustrup1997]</a>
+ and <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>.
+ </p>
+<p>
+ The run-time performances are negatively impacted by Contract Programming
+ mainly because of the following:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The extra processing required to check the assertions.
+ </li>
+<li class="listitem">
+ The extra processing required by the additional function calls (additional
+ functions are invoked to check class invariants, preconditions, and postconditions).
+ </li>
+<li class="listitem">
+ The extra processing required to copy object and function arguments when
+ their old values are accessed in postconditions.
+ </li>
+</ol></div>
+<p>
+ To alleviate some of these run-time performance impacts, you can selectively
+ turn off some of the contract compilation and the related run-time checking.
+ In reality, you will have to decide based on the performance trade-offs required
+ by your system but a reasonable approach might be to <sup>[<a name="id952047" href="#ftn.id952047" class="footnote">21</a>]</sup>:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Always write contracts to clarify the semantics of your design embedding
+ them directly into the code and its documentation.
+ </li>
+<li class="listitem">
+ Turn on class invariants, preconditions, and postconditions compilation
+ and checking during early testing.
+ </li>
+<li class="listitem">
+ Turn on only preconditions (and possibly class invariants) during release
+ testing and for the final release. (Postconditions are usually more expensive
+ to check.)
+ </li>
+</ul></div>
+<p>
+ Compile-time performances are also impacted by this library as compilation
+ time and compiler memory usage increase mainly because:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The contracts appear in the class declaration (usually header files)
+ so they have to be re-compiled for each translation unit.
+ </li>
+<li class="listitem">
+ The library implementation extensively uses C++ preprocessor and template
+ metaprogramming which can significantly stress some compilers.
+ </li>
+</ol></div>
+<p>
+ In addition, Contract Programming might induce a false sense of security
+ on the correctness of the software. However, Contract Programming is proposed
+ here as a tool to complement (and not to substitute) testing.
+ </p>
+<p>
+ In general, Contract Programming is an essential approach to improve software
+ quality even if it comes at a performance cost. While performance trade-offs
+ should be carefully considered depending on the specific application domain,
+ software quality cannot be sacrificed -- it is difficult to see the value
+ of a system that quickly and efficiently provides the incorrect output.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.contract_programming.other_tools"></a><a class="link" href="contract_programming.html#contract__.contract_programming.other_tools" title="Other Tools">Other Tools</a>
+</h3></div></div></div>
+<p>
+ Contract Programming is also supported by the following tools (this is <span class="emphasis"><em>not</em></span>
+ a complete list):
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[Bright2004b]</a> is the Digital
+ Mars C++ compiler with added Contract Programming support.
+ </li>
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[C^2]</a> implements Contract
+ Programming for C++ using an external preprocessing tool.
+ </li>
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[Spec#]</a> extends C# with
+ Contract Programming.
+ </li>
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[iContract]</a> and <a class="link" href="bibliography.html" title="Bibliography">[Jcontract]</a> are external preprocessing
+ tools that implement Contract Programming for Java.
+ </li>
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[Chrome2002]</a> is Object
+ Pascal in .NET with Contract Programming support.
+ </li>
+<li class="listitem">
+ <a class="link" href="bibliography.html" title="Bibliography">[SPARKAda]</a> is an Ada-like
+ programming language with Contract Programming support.
+ </li>
+</ul></div>
+<p>
+ Typically, preprocessing tools external to the language work by transforming
+ specially formatted code comments into contract code that is then checked
+ at run-time.
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id950232" href="#id950232" class="para">19</a>] </sup>
+ These are all revisions of the same proposal for adding Contract Programming
+ to the C++ standard.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id951869" href="#id951869" class="para">20</a>] </sup>
+ Of course, if the contract is 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 they 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 they
+ make a mistake twice (in the body <span class="emphasis"><em>and</em></span> in the contract)
+ is lower than the probability that the mistake is made just once (in
+ the body).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id952047" href="#id952047" class="para">21</a>] </sup>
+ This approach is generally reasonable because in well tested production
+ code, validating the function body implementation via postconditions and
+ class invariants is rarely needed since the function has shown itself to
+ be "correct" during testing. On the other hand, checking arguments
+ has continuing need because of the evolution of the callers.
+ </p></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="throw_on_failure.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="Grammar.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/examples.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/examples.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,1572 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Examples</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="without_the_macros.html" title="Without the Macros">
+<link rel="next" href="throw_on_failure.html" title="Annex: Throw on Failure">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="without_the_macros.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="throw_on_failure.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.examples"></a><a class="link" href="examples.html" title="Examples">Examples</a>
+</h2></div></div></div>
+<p>
+ This section provides source code of fully working examples that can all be
+ compiled and executed using this library. The most interesting examples (from
+ the authors' prospective) have highlighted keywords in their purpose descriptions.
+ </p>
+<p>
+ All examples presented in the Contract Programming proposal for the C++ standard
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a> are programmed here
+ using the library. Most of the other examples have been ported to C++ from
+ Eiffel code using this library and they were originally presented in <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a> and <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ Remember to #define the <code class="computeroutput">CONTRACT_CHECK_BLOCK_INVARIANT</code>,
+ <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>,
+ <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>,
+ and <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ macro symbols using your compiler options (these symbols are #undefined by
+ default, see the <a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>
+ section).
+ </p></td></tr>
+</table></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Contract++ Library Syntax (supported by ISO C++)
+ </p>
+ </th>
+<th>
+ <p>
+ N1962 and ConceptC++ Syntax (proposals not part of C++0x standard)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</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">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// For boost::prior().</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+<span class="comment">// Contract helpers.</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">)</span>
+ <span class="identifier">requires</span><span class="special">(</span> <span class="comment">// Concepts.</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="comment">// For simplicity, assume T comparable.</span>
+ <span class="special">)</span>
+<span class="keyword">bool</span> <span class="special">(</span><span class="identifier">all_equals</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">last</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">for</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">val</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">Iter</span> <span class="special">)</span>
+ <span class="identifier">requires</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">FowardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">FowardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>::</span><span class="identifier">value_type</span><span class="special">></span>
+ <span class="special">)</span>
+<span class="keyword">bool</span> <span class="special">(</span><span class="identifier">all_equals</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">first1</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">last1</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">first2</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">last2</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first1</span><span class="special">,</span> <span class="identifier">last1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first2</span><span class="special">,</span> <span class="identifier">last2</span><span class="special">)</span>
+ <span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">j</span> <span class="special">=</span> <span class="identifier">first2</span><span class="special">;</span>
+ <span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last1</span> <span class="special">&&</span> <span class="identifier">j</span> <span class="special"><</span> <span class="identifier">last2</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="special">*</span><span class="identifier">j</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">i</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Size</span> <span class="special">)</span>
+ <span class="identifier">requires</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+ <span class="comment">// `IDENTITY_TYPE()` to handle commas within macro parameters.</span>
+ <span class="keyword">typename</span> <span class="identifier">CONTRACT_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">Convertible</span><span class="special"><</span><span class="identifier">Size</span><span class="special">,</span> <span class="keyword">int</span><span class="special">>))</span>
+ <span class="special">)</span>
+<span class="keyword">bool</span> <span class="special">(</span><span class="identifier">equal_distance</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">last</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Size</span><span class="special">)</span> <span class="identifier">size</span> <span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span> <span class="comment">// Could tag for in-iter.</span>
+<span class="special">}</span>
+
+<span class="comment">// New vector interface (with contracts).</span>
+
+<span class="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">,</span> <span class="keyword">default</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)</span> <span class="comment">// No base classes so no subcontracting for this example.</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_CLASS_INVARIANT</span><span class="special">(</span> <span class="comment">// Used within a private context.</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">),</span>
+ <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">())</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">()),</span>
+ <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">())</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rbegin</span><span class="special">(),</span> <span class="identifier">rend</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">capacity</span><span class="special">(),</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">max_size</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="comment">// No static class invariants for this example.</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">reverse_iterator</span> <span class="identifier">reverse_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_reverse_iterator</span>
+ <span class="identifier">const_reverse_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">reference</span> <span class="identifier">reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)()</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">()</span> <span class="special">)</span> <span class="comment">// Member initializers.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">explicit</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&)</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">al</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">(),</span> <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">explicit</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="special">(</span><span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">))</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">T</span><span class="special">())</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&)</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">,</span> <span class="identifier">al</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">,</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">),</span>
+ <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">vector</span><span class="special">&)</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">right</span> <span class="special">==</span> <span class="special">*</span><span class="keyword">this</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">)</span> <span class="identifier">requires</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">())</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">)</span> <span class="identifier">requires</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">vector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">last</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&)</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">al</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_DESTRUCTOR</span><span class="special">(</span> <span class="comment">// Contracted so also destructor checks invariants.</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)()</span>
+ <span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">reserve</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">count</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">count</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capacity</span><span class="special">)()</span> <span class="keyword">const</span> <span class="comment">// Constant member.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">)</span> <span class="comment">// With result.</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span> <span class="comment">// Select assertion.</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="comment">// Contracted even if no pre/post so to check invariants.</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">end</span><span class="special">)()</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">end</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reverse_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">rbegin</span><span class="special">)()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">rend</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rbegin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reverse_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">rbegin</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">rend</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rbegin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reverse_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">rend</span><span class="special">)()</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rend</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reverse_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">rend</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rend</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">resize</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">newsize</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span> <span class="comment">// Old values.</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">newsize</span><span class="special">,</span>
+ <span class="comment">// Version 1: with an if.</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">newsize</span> <span class="special">></span> <span class="identifier">old_size</span><span class="special">)</span> <span class="special">(</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">old_size</span><span class="special">,</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">T</span><span class="special">())</span>
+ <span class="special">)</span> <span class="keyword">else</span> <span class="special">(</span>
+ <span class="keyword">true</span> <span class="comment">// Dummy assertion to show the optional else branch.</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">newsize</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">resize</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">newsize</span><span class="special">,</span> <span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span> <span class="comment">// Specify old type.</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">newsize</span><span class="special">,</span>
+ <span class="comment">// Version 2: with a ternary operator `condition ? then : else`.</span>
+ <span class="identifier">newsize</span> <span class="special">></span> <span class="identifier">old_size</span> <span class="special">?</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">old_size</span><span class="special">,</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">)</span> <span class="special">:</span> <span class="keyword">true</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">newsize</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="special">(</span><span class="identifier">size</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="identifier">result</span> <span class="special"><=</span> <span class="identifier">capacity</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="special">(</span><span class="identifier">max_size</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="identifier">capacity</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">bool</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="identifier">result</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">Alloc</span><span class="special">)</span> <span class="special">(</span><span class="identifier">get_allocator</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">get_allocator</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">at</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">off</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">off</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">at</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">off</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">off</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="comment">// Operators name in both symbol `[]` and word `at`.</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">operator</span><span class="special">([],</span> <span class="identifier">at</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">off</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">off</span><span class="special">];</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="keyword">operator</span><span class="special">([],</span> <span class="identifier">at</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">off</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">off</span><span class="special">];</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">front</span><span class="special">)()</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="keyword">bool</span><span class="special">(!</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// `bool()` handles leading `!`.</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">front</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">front</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span> <span class="special">)</span> <span class="comment">// `== false` instead of `!`.</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">front</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">back</span><span class="special">)()</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">identity</span><span class="special">(!</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// `identity` for `!`.</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="special">(</span><span class="identifier">back</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="keyword">auto</span> <span class="identifier">old_capacity</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()),</span>
+ <span class="identifier">back</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">val</span><span class="special">,</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">old_capacity</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">pop_back</span><span class="special">)()</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">-</span> <span class="number">1</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">)</span> <span class="identifier">requires</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span> <span class="special">)</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">assign</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="comment">/** @pre [first, last) not sub-range of [begin(), end()). */</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">())</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">assign</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">count</span> <span class="special"><=</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">insert</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">pos</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="identifier">val</span> <span class="special">==</span> <span class="special">*</span><span class="identifier">result</span><span class="special">,</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span>
+ <span class="keyword">auto</span> <span class="identifier">old_capacity</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()),</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">old_capacity</span>
+ <span class="comment">/** @post
+ * if capacity() > oldof capacity():
+ * all iterators invalidated
+ * else:
+ * all iterators in [pos, end()) invalidated
+ */</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">insert</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">pos</span><span class="special">,</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">></span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="keyword">auto</span> <span class="identifier">old_capacity</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()),</span>
+ <span class="keyword">auto</span> <span class="identifier">old_pos</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">pos</span><span class="special">),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">,</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">old_capacity</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_capacity</span><span class="special">)</span> <span class="special">(</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">old_pos</span><span class="special">),</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">old_pos</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">)</span>
+ <span class="comment">/** @post All iterators in [pos, end()) invalidated. */</span>
+ <span class="special">)</span>
+ <span class="comment">/** @post Else, all iterators invalidated. */</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">)</span> <span class="identifier">requires</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span> <span class="special">)</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">insert</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">pos</span><span class="special">,</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">InIt</span><span class="special">)</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="comment">/** @pre [first, last) not a sub-range of [begin(), end()). */</span>
+ <span class="identifier">max_size</span><span class="special">()</span> <span class="special">></span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="keyword">auto</span> <span class="identifier">old_capacity</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">),</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">old_capacity</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">erase</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">pos</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">,</span>
+ <span class="identifier">pos</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+ <span class="comment">/** @post Iterators in [pos, end()) invalidated. */</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">pos</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">erase</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">-</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">),</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+ <span class="comment">/** @post Iterators in [first, end()) invalidated. */</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">clear</span><span class="special">)()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">swap</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">&)</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_self</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(*</span><span class="keyword">this</span><span class="special">),</span> <span class="comment">// Deep copy (not just ptr).</span>
+ <span class="keyword">auto</span> <span class="identifier">old_right</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">right</span><span class="special">),</span>
+ <span class="identifier">right</span> <span class="special">==</span> <span class="identifier">old_self</span><span class="special">,</span>
+ <span class="identifier">old_right</span> <span class="special">==</span> <span class="special">*</span><span class="keyword">this</span><span class="special">,</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">swap</span><span class="special">(</span><span class="identifier">right</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">(==,</span> <span class="identifier">equal</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">vector</span><span class="special">&)</span> <span class="identifier">right</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span>
+ <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span>
+ <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">concepts</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+<span class="comment">// Contract helpers.</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">></span>
+ <span class="identifier">requires</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
+
+<span class="keyword">bool</span> <span class="identifier">all_equals</span><span class="special">(</span> <span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">for</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">val</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Iter</span> <span class="special">></span>
+ <span class="identifier">requires</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>::</span><span class="identifier">value_type</span><span class="special">></span>
+
+<span class="keyword">bool</span> <span class="identifier">all_equals</span><span class="special">(</span> <span class="identifier">Iter</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last1</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">first2</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last2</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first1</span><span class="special">,</span> <span class="identifier">last1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first2</span><span class="special">,</span> <span class="identifier">last2</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">{</span>
+ <span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">j</span> <span class="special">=</span> <span class="identifier">first2</span><span class="special">;</span>
+ <span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last1</span> <span class="special">&&</span> <span class="identifier">j</span> <span class="special"><</span> <span class="identifier">last2</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="special">*</span><span class="identifier">j</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">i</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Size</span> <span class="special">></span>
+ <span class="identifier">requires</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ForwardIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span>
+
+ <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">Convertible</span><span class="special"><</span><span class="identifier">Size</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span>
+
+<span class="keyword">bool</span> <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Size</span> <span class="identifier">size</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+<span class="special">}</span>
+
+<span class="comment">// New vector interface (with contracts).</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">vector</span>
+<span class="special">{</span>
+ <span class="identifier">invariant</span> <span class="special">{</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+ <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">())</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">());</span>
+ <span class="keyword">int</span><span class="special">(</span><span class="identifier">size</span><span class="special">())</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rbegin</span><span class="special">(),</span> <span class="identifier">rend</span><span class="special">());</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">capacity</span><span class="special">();</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">max_size</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="comment">// No static class invariants allowed (could be `static invariant { ... }`).</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">reverse_iterator</span> <span class="identifier">reverse_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_reverse_iterator</span>
+ <span class="identifier">const_reverse_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">reference</span> <span class="identifier">reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">vector</span><span class="special">()</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">()</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">explicit</span> <span class="identifier">vector</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">al</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">();</span> <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">explicit</span> <span class="identifier">vector</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">;</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">T</span><span class="special">());</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">vector</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">;</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">);</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">vector</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">,</span> <span class="identifier">al</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+ <span class="identifier">size</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">;</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">vector</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">vector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">right</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">right</span> <span class="special">==</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">></span> <span class="identifier">requires</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span>
+ <span class="identifier">vector</span><span class="special">(</span> <span class="identifier">InIt</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InIt</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">());</span> <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">></span> <span class="identifier">requires</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span>
+ <span class="identifier">vector</span><span class="special">(</span> <span class="identifier">InIt</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InIt</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Alloc</span><span class="special">&</span> <span class="identifier">al</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">al</span><span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+ <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">());</span>
+ <span class="identifier">al</span> <span class="special">==</span> <span class="identifier">get_allocator</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="special">~</span><span class="identifier">vector</span><span class="special">()</span>
+ <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">reserve</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">count</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">count</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">reverse</span><span class="special">(</span><span class="identifier">count</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">size_type</span> <span class="identifier">capacity</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">begin</span><span class="special">()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">end</span><span class="special">()</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reverse_iterator</span> <span class="identifier">rbegin</span><span class="special">()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">rend</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rbegin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reverse_iterator</span> <span class="identifier">rbegin</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">rend</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rbegin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reverse_iterator</span> <span class="identifier">rend</span><span class="special">()</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rend</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reverse_iterator</span> <span class="identifier">rend</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">rend</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">resize</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">newsize</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">newsize</span><span class="special">;</span>
+ <span class="comment">// Version 1: with an if.</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">newsize</span> <span class="special">></span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">())</span> <span class="special">{</span> <span class="comment">// Old values.</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">T</span><span class="special">());</span>
+ <span class="special">}</span> <span class="keyword">else</span> <span class="special">{</span>
+ <span class="keyword">true</span><span class="special">;</span> <span class="comment">// Dummy assertion to show the optional else branch.</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">newsize</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">resize</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">newsize</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">newsize</span><span class="special">;</span>
+ <span class="comment">// Version 2: with ternary operator `condition ? then : else`.</span>
+ <span class="identifier">newsize</span> <span class="special">></span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">?</span> <span class="comment">// then</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">)</span> <span class="special">:</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">newsize</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special"><=</span> <span class="identifier">capacity</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="identifier">capacity</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vactor_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">Alloc</span> <span class="identifier">get_allocator</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">get_allocator</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reference</span> <span class="identifier">at</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">off</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">off</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reference</span> <span class="identifier">at</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">off</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">off</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reference</span> <span class="keyword">operator</span><span class="special">[](</span> <span class="identifier">size_type</span> <span class="identifier">off</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">off</span><span class="special">];</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span> <span class="identifier">size_type</span> <span class="identifier">off</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">off</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">off</span><span class="special">];</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reference</span> <span class="identifier">front</span><span class="special">()</span>
+ <span class="identifier">recondition</span> <span class="special">{</span> <span class="keyword">bool</span><span class="special">(!</span><span class="identifier">empty</span><span class="special">());</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">front</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reference</span> <span class="identifier">front</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">front</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">reference</span> <span class="identifier">back</span><span class="special">()</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="special">!</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reference</span> <span class="identifier">back</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+
+ <span class="identifier">back</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">val</span><span class="special">;</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="identifier">pubilc</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">pop_back</span><span class="special">()</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">;</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">-</span> <span class="number">1</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="identifier">pubilc</span><span class="special">:</span> <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">></span> <span class="identifier">requires</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span>
+ <span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span> <span class="identifier">InIt</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InIt</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="comment">/** @pre [first, last) not sub-range of [begin(), end()). */</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">equal_distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">size</span><span class="special">());</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">count</span> <span class="special"><=</span> <span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">val</span><span class="special">);</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">assign</span><span class="special">(</span><span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">insert</span><span class="special">(</span> <span class="identifier">iterator</span> <span class="identifier">where</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="identifier">val</span> <span class="special">==</span> <span class="special">*</span><span class="identifier">result</span><span class="special">;</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">();</span>
+ <span class="comment">/** @post
+ * if capacity() > oldof capacity():
+ * all iterators invalidated
+ * else:
+ * all iterators in [pos, end()) invalidated
+ */</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">insert</span><span class="special">(</span> <span class="identifier">iterator</span> <span class="identifier">pos</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">val</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">count</span> <span class="special"><=</span> <span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">;</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">();</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">())</span> <span class="special">{</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">oldof</span> <span class="identifier">pos</span><span class="special">),</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">oldof</span> <span class="identifier">pos</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="comment">/** @post All iterators in [pos, end()) invalidated. */</span>
+ <span class="special">}</span>
+ <span class="comment">/** @post Else, all iterators invalidated. */</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">val</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">InIt</span> <span class="special">></span> <span class="identifier">requires</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">InIt</span><span class="special">></span>
+ <span class="keyword">void</span> <span class="identifier">insert</span><span class="special">(</span> <span class="identifier">iterator</span> <span class="identifier">where</span><span class="special">,</span> <span class="identifier">InIt</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InIt</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="comment">/** @pre [first, last) not a sub-range of [begin(), end()). */</span>
+ <span class="identifier">max_size</span><span class="special">()</span> <span class="special">>=</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">));</span>
+ <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="identifier">capacity</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">pos</span><span class="special">,</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">erase</span><span class="special">(</span> <span class="identifier">iterator</span> <span class="identifier">pos</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">pos</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">{</span>
+
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">-</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="comment">/** @post Iterators in [pos, end()) invalidated. */</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">pos</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">erase</span><span class="special">(</span> <span class="identifier">iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span> <span class="special">}</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span> <span class="special">);</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="comment">/** @post Iterators in [first, end()) invalidated. */</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">clear</span><span class="special">()</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span> <span class="identifier">vector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+
+ <span class="identifier">right</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
+ <span class="identifier">oldof</span> <span class="identifier">right</span> <span class="special">==</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">swap</span><span class="special">(</span><span class="identifier">right</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">==(</span> <span class="keyword">const</span> <span class="identifier">vector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">end</span><span class="special">(),</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span>
+ <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Source
+ </p>
+ </th>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ Purpose
+ </p>
+ </th>
+<th>
+ <p>
+ Files
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ STL Vector
+ </p>
+ </td>
+<td>
+ <p>
+ <span class="bold"><strong>Complete contracts</strong></span> for STL vector.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Block
+ </p>
+ </td>
+<td>
+ <p>
+ Block invariants.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Circle
+ </p>
+ </td>
+<td>
+ <p>
+ Subcontracting.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Factorial
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts with recursion.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Operator Equal
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for operators.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Square Root
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for non-member functions.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Sum
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for non-member functions (with separated definition).
+ </p>
+ </td>
+<td>
+ <p>
+ sum.hpp sum.cpp main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Name List
+ </p>
+ </td>
+<td>
+ <p>
+ Relax base class preconditions using <span class="bold"><strong>subcontracting</strong></span>.
+ </p>
+ </td>
+<td>
+ <p>
+ names.hpp
+ names.cpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Courier
+ </p>
+ </td>
+<td>
+ <p>
+ Relax base class preconditions using subcontracting.
+ </p>
+ </td>
+<td>
+ <p>
+ couriers.hpp
+ couriers.cpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Dictionary
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for a dictionary (map-like) data-type.
+ </p>
+ </td>
+<td>
+ <p>
+ dictionary.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Stack
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for a stack.
+ </p>
+ </td>
+<td>
+ <p>
+ stack.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Simple Queue
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for a queue.
+ </p>
+ </td>
+<td>
+ <p>
+ simple_queue.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Customer Manager
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for a class manging customers.
+ </p>
+ </td>
+<td>
+ <p>
+ customer_manager.hpp
+ customer_manager.cpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Observe
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for the observer design pattern.
+ </p>
+ </td>
+<td>
+ <p>
+ observe.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Counter
+ </p>
+ </td>
+<td>
+ <p>
+ <span class="bold"><strong>Relaxe the accessible copy constructor requirement</strong></span>
+ for old <code class="computeroutput"><span class="identifier">decrement_button</span></code>
+ objects in postconditions.
+ </p>
+ </td>
+<td>
+ <p>
+ counter.hpp
+ view_of_counter.hpp
+ push_button.hpp
+ decrement_button.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Stack3
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for functions returning <span class="bold"><strong>error codes</strong></span>.
+ </p>
+ </td>
+<td>
+ <p>
+ stack3.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Stack4
+ </p>
+ </td>
+<td>
+ <p>
+ Contracts for stack.
+ </p>
+ </td>
+<td>
+ <p>
+ stack4.hpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Greatest Common Divisor
+ </p>
+ </td>
+<td>
+ <p>
+ <span class="bold"><strong>Block invariants and loop variants.</strong></span>
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ Max Array
+ </p>
+ </td>
+<td>
+ <p>
+ Block invariants and loop variants.
+ </p>
+ </td>
+<td>
+ <p>
+ main.cpp
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Stroustrup1997]</a>
+ </p>
+ </td>
+<td>
+ <p>
+ String
+ </p>
+ </td>
+<td>
+ <p>
+ Precondition and invariants (no postconditions).
+ </p>
+ </td>
+<td>
+ <p>
+ string.hpp
+ string.cpp
+ main.cpp
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="without_the_macros.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="throw_on_failure.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/getting_started.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/getting_started.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,225 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Getting Started</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="../index.html" title="Contract++ 0.3.490">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Installation</span></dt>
+<dt><span class="section">Header Files</span></dt>
+<dt><span class="section"><a href="getting_started.html#contract__.getting_started.control_contract_compilation">Control
+ Contract Compilation</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#contract__.getting_started.names_and_symbols">Names and
+ Symbols</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#contract__.getting_started.compile_time_configuration">Compile-Time
+ Configuration</a></span></dt>
+</dl></div>
+<p>
+ This section illustrates how to setup your system to use this library.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.getting_started.installation"></a><a class="link" href="getting_started.html#contract__.getting_started.installation" title="Installation">Installation</a>
+</h3></div></div></div>
+<p>
+ This library requires the Boost.MPL
+ and Boost.Preprocessor
+ libraries. The Boost library is
+ a collection of highly portable C++ libraries. You should be able to download,
+ compile, and install Boost for
+ your operating system from the Boost
+ website. Precompiled Boost installation
+ packages are also available for most common operating systems and they might
+ already be installed on your system.
+ </p>
+<p>
+ This library is composed of header files only. Therefore there are no library
+ precompiled object files which need to be installed. Just instruct your C++
+ compiler where to find the library header files (e.g., using the '-I' option
+ for GCC or '/I' for MSVC). For example, if you have uncompressed the library
+ files in a directory named <code class="computeroutput"><span class="string">"$HOME/libs/contractpp/"</span></code>
+ then you can compile with GCC using:
+ </p>
+<pre class="programlisting">$ g++ -I$HOME/libs/contractpp/src/ ...
+</pre>
+<p>
+ Note that the path of the library source files (contained in the <code class="computeroutput"><span class="string">"src/"</span></code> subdirectory) is specified.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.getting_started.header_files"></a><a class="link" href="getting_started.html#contract__.getting_started.header_files" title="Header Files">Header Files</a>
+</h3></div></div></div>
+<p>
+ The library headers are simply included in your C++ source code as follow:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">contract</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ In general, there is no need to include the header files from the <code class="literal">"contract/"</code>
+ directory separately and the one include above is enough. In this documentation,
+ the <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">contract</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
+ will occasionally be assumed and omitted from the example code.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.getting_started.control_contract_compilation"></a><a class="link" href="getting_started.html#contract__.getting_started.control_contract_compilation" title="Control Contract Compilation">Control
+ Contract Compilation</a>
+</h3></div></div></div>
+<p>
+ This library provides the following macro symbols to selectively turn on
+ or off contract compilation and run-time checking:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <span class="bold"><strong>Block invariants</strong></span> and <span class="bold"><strong>loop
+ variants</strong></span> are compiled and checked only if the <code class="computeroutput">CONTRACT_CHECK_BLOCK_INVARIANT</code>
+ is #defined. By default, this macro symbol is <span class="emphasis"><em>not</em></span>
+ #defined.
+ </li>
+<li class="listitem">
+ <span class="bold"><strong>Class invariants</strong></span> are compiled and checked
+ only if the <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>
+ is #defined. By default, this macro symbol is <span class="emphasis"><em>not</em></span>
+ #defined.
+ </li>
+<li class="listitem">
+ <span class="bold"><strong>Preconditions</strong></span> are compiled and checked
+ only if the <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>
+ is #defined. By default, this macro symbol is <span class="emphasis"><em>not</em></span>
+ #defined.
+ </li>
+<li class="listitem">
+ <span class="bold"><strong>Postconditions</strong></span> are compiled and checked
+ only if the <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ is #defined. By default, this macro symbol is <span class="emphasis"><em>not</em></span>
+ #defined. In addition, the library copies variables to support old values
+ in postconditions only when <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ is #defined (in this case, these extra copy operations will introduce
+ some run-time overhead).
+ </li>
+</ul></div>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Contracts Off by Default</strong></span>
+ </p>
+<p>
+ All these symbols are #undefined by default so you must define them when
+ compiling otherwise the library will do nothing.
+ </p>
+</td></tr>
+</table></div>
+<p>
+ In Contract Programming, it is usually important to be able to selectively
+ turn off compilation of invariants, preconditions, and/or postconditions
+ for the sake of run-time efficiency, to reduce the size of the compiled object
+ code, and also to reduce the compile-time overhead associated with the compilation
+ of contracts. However, be aware that when contract compilation is turned
+ off the compiler will not even check that the contract code is syntactically
+ correct (so it might be good practice to compile with the contracts turned
+ on once to maintain the contract code even if the contracts will be turned
+ off in the actual release build).
+ </p>
+<p>
+ These macros must be #defined before the library <span class="emphasis"><em>first</em></span>
+ #include. Your compiler options to #define macros can be used to this purpose
+ ("-D" and "-U" for GCC, "/D" and "/U"
+ for Microsoft Visual C++, etc).
+ </p>
+<p>
+ For example, let's assume we only want to check class invariants and preconditions
+ but no postconditions and block invariants. Then we have to #define <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>
+ and <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>
+ but leave <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ and <code class="computeroutput">CONTRACT_CHECK_BLOCK_INVARIANT</code>
+ #undefined. If we are using the GCC compiler, we can do this using the following
+ command line options:
+ </p>
+<pre class="programlisting">$ g++ -DCONTRACT_CHECK_CLASS_INVARIANT -DCONTRACT_CHECK_PRECONDITION
+ -UCONTRACT_CHECK_POSTCONDITION -UCONTRACT_CHECK_BLOCK_INVARIANT ...
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.getting_started.names_and_symbols"></a><a class="link" href="getting_started.html#contract__.getting_started.names_and_symbols" title="Names and Symbols">Names and
+ Symbols</a>
+</h3></div></div></div>
+<p>
+ All library names are defined within the <code class="computeroutput"><span class="identifier">contract</span></code>
+ namespace. All library macros start with the <code class="computeroutput"><span class="identifier">CONTRACT</span></code>
+ prefix. Any library names, macros, files, directories, etc that end with
+ an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ are library implementation specific and should <span class="emphasis"><em>not</em></span> be
+ used directly in user code by programmers.
+ </p>
+<p>
+ This library needs to <span class="emphasis"><em>augment</em></span> the user code with special
+ symbols to implement the contracts. These symbols need to be defined within
+ the user code namespace. All these symbols start with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and end with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ to prevent name clashes with user code. Again, these symbols end with an
+ underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so they are library implementation specific and should <span class="emphasis"><em>not</em></span>
+ be used directly in user code by programmers.
+ </p>
+<p>
+ Finally, all library names in the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">aux</span></code> namespace
+ and symbols starting with <code class="computeroutput"><span class="identifier">CONTRACT_AUX</span></code>
+ are also library implementation specific and should <span class="emphasis"><em>not</em></span>
+ be used directly in user code by programmers.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.getting_started.compile_time_configuration"></a><a class="link" href="getting_started.html#contract__.getting_started.compile_time_configuration" title="Compile-Time Configuration">Compile-Time
+ Configuration</a>
+</h3></div></div></div>
+<p>
+ Some of the library behaviour can be changed at compile-time #defining special
+ <span class="emphasis"><em>configuration macros</em></span> (<code class="computeroutput">CONTRACT_CONFIG_MAX_FUNCTION_ARITY</code>,
+ <code class="computeroutput">CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</code>,
+ etc). If configuration macros are not #defined, the library will use appropriate
+ default values for them.
+ </p>
+<p>
+ The library configuration macros can be #defined using your compiler options
+ similarly to what discussed above. However, it is strongly recommended <span class="emphasis"><em>not</em></span>
+ to change the library compile-time configuration unless strictly necessary.
+ </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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/grammar.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/grammar.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,739 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Appendix: Grammar</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="contract_programming.html" title="Annex: Contract Programming">
+<link rel="next" href="../reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract_programming.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.Grammar"></a><a class="link" href="Grammar.html" title="Appendix: Grammar">Appendix: Grammar</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Contract Macros</span></dt>
+<dt><span class="section">Terminals</span></dt>
+<dt><span class="section">Lexical Conventions</span></dt>
+<dt><span class="section">Class Signature</span></dt>
+<dt><span class="section"><a href="Grammar.html#contract__.Grammar.constructor_signature">Constructor
+ Signature</a></span></dt>
+<dt><span class="section">Destructor Signature</span></dt>
+<dt><span class="section">Function Signature</span></dt>
+<dt><span class="section"><a href="Grammar.html#contract__.Grammar.postcondition_s_result_and_old_of">Postcondition's
+ Result and Old-Of</a></span></dt>
+<dt><span class="section"><a href="Grammar.html#contract__.Grammar.positional_function_parameters">Positional
+ Function Parameters</a></span></dt>
+<dt><span class="section"><a href="Grammar.html#contract__.Grammar.named_function_parameters">Named Function
+ Parameters</a></span></dt>
+<dt><span class="section">Template Parameters</span></dt>
+<dt><span class="section">Assertions</span></dt>
+<dt><span class="section">Loop Variant</span></dt>
+<dt><span class="section">New Keywords</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.contract_macros"></a><a class="link" href="Grammar.html#contract__.Grammar.contract_macros" title="Contract Macros">Contract Macros</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-class-signature</em></span> <span class="special">)</span>
+
+<span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-constructor-signature</em></span> <span class="special">)</span>
+<span class="identifier">CONTRACT_DESTRUCTOR</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-destructor-signature</em></span> <span class="special">)</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-function-signature</em></span> <span class="special">)</span> <span class="comment">// Used for both member and non-member functions.</span>
+
+<span class="identifier">CONTRACT_CLASS_INVARIANT</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>
+<span class="identifier">CONTRACT_STATIC_CLASS_INVARIANT</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>
+<span class="identifier">CONTRACT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>
+
+<span class="identifier">CONTRACT_LOOP</span><span class="special">(</span> <span class="bold"><strong>loop-signature</strong></span> <span class="special">)</span>
+<span class="identifier">CONTRACT_LOOP_END</span>
+<span class="identifier">CONTRACT_LOOP_VARIANT</span><span class="special">(</span> <span class="emphasis"><em>parenthesized-variant</em></span> <span class="special">)</span>
+
+<span class="identifier">CONTRACT_CONSTRUCTOR_BODY</span><span class="special">(</span><span class="bold"><strong>class-type</strong></span><span class="special">,</span> <span class="bold"><strong>class-name</strong></span><span class="special">)</span>
+<span class="identifier">CONTRACT_DESTRUCTOR_BODY</span><span class="special">(</span><span class="bold"><strong>class-type</strong></span><span class="special">,</span> <span class="bold"><strong>class-name</strong></span><span class="special">)</span>
+<span class="identifier">CONTRACT_MEMBER_BODY</span><span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)</span>
+<span class="identifier">CONTRACT_NONMEMBER_BODY</span><span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.terminals"></a><a class="link" href="Grammar.html#contract__.Grammar.terminals" title="Terminals">Terminals</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Terminal
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+ <code class="literal"><span class="bold"><strong>class-name</strong></span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The name of a class. It is never prefixed by <code class="computeroutput"><span class="special">~</span></code>
+ not even when specified within destructor contract macros. It does
+ not specify the class namespace or eventual template parameters
+ for a class template, just the class name.
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section"><div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.lexical_conventions"></a><a class="link" href="Grammar.html#contract__.Grammar.lexical_conventions" title="Lexical Conventions">Lexical Conventions</a>
+</h3></div></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.class_signature"></a><a class="link" href="Grammar.html#contract__.Grammar.class_signature" title="Class Signature">Class Signature</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-class-signature:</em></span>
+ /[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>template-parameter+</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span> <span class="special">(</span><span class="bold"><strong>concept</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">)</span>/]]/
+ <span class="emphasis"><em>class-specifier</em></span> <span class="special">(</span><span class="bold"><strong>class-name</strong></span><span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">extends</span><span class="special">)(</span> <span class="emphasis"><em>base-class+</em></span> <span class="special">)</span>/]/
+
+<span class="emphasis"><em>class-specifier:</em></span>
+ <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">struct</span><span class="special">)</span>
+
+<span class="emphasis"><em>base-class:</em></span>
+ /[/<span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span>/]/
+ /[access-level]/
+ <span class="special">(</span><span class="bold"><strong>base-class-type</strong></span><span class="special">)</span>
+
+<span class="emphasis"><em>access-level:</em></span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">protected</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">private</span><span class="special">)</span>
+</pre>
+<p>
+ As usual in C++, classes (or structures) are specified by using the <code class="computeroutput"><span class="special">(</span><span class="keyword">class</span><span class="special">)</span></code>
+ (or <code class="computeroutput"><span class="special">(</span><span class="keyword">struct</span><span class="special">)</span></code>) keyword, base classes without an explicit
+ access level are inherited privately (or publicly), and members access levels
+ start as private (or public) within the class (or structure) declaration
+ body until otherwise specified. Contracts are not supported for <code class="computeroutput"><span class="keyword">union</span></code>s (this limitation might be relaxed in
+ future revisions of this library).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.constructor_signature"></a><a class="link" href="Grammar.html#contract__.Grammar.constructor_signature" title="Constructor Signature">Constructor
+ Signature</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-constructor-signature:</em></span>
+ <span class="emphasis"><em>access-level</em></span>
+ /[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>template-parameters</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span> <span class="special">(</span><span class="bold"><strong>concept</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">)</span>/]]/
+ /[/<span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/
+ <span class="special">(</span><span class="bold"><strong>class-name</strong></span><span class="special">)(</span> <span class="emphasis"><em>parameters</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="emphasis"><em>exceptions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">initialize</span><span class="special">)(</span> <span class="special">(</span><span class="bold"><strong>member-initializer</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">postcondition</span> <span class="emphasis"><em>oldof-assignments</em></span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+
+<span class="emphasis"><em>parameters:</em></span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="comment">// Mandatory for no parameters.</span>
+ <span class="emphasis"><em>| positional-parameters</em></span>
+ <span class="emphasis"><em>| named-parameters</em></span>
+
+<span class="emphasis"><em>exceptions:</em></span>
+ <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="comment">// Specify the function throws no exception.</span>
+ <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="bold"><strong>exception-type</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Constructor preconditions cannot access the object <code class="computeroutput"><span class="keyword">this</span></code>
+ (because there is no object before constructor body execution).
+ </li>
+<li class="listitem">
+ Constructor postcondition <code class="literal"><span class="emphasis"><em>oldof-assignments</em></span></code>
+ cannot access the object <code class="computeroutput"><span class="keyword">this</span></code>
+ (because there was no object before constructor body execution).
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.destructor_signature"></a><a class="link" href="Grammar.html#contract__.Grammar.destructor_signature" title="Destructor Signature">Destructor Signature</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-destructor-signature:</em></span>
+ <span class="emphasis"><em>access-level</em></span>
+ /[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span>/]/
+ <span class="special">(</span><span class="bold"><strong>class-name</strong></span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="emphasis"><em>exceptions</em></span> <span class="special">)</span>/]/
+</pre>
+<p>
+ Destructors have no preconditions and no postconditions (but they have a
+ contract because they check the class invariants).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.function_signature"></a><a class="link" href="Grammar.html#contract__.Grammar.function_signature" title="Function Signature">Function Signature</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-function-signature:</em></span>
+ <span class="emphasis"><em>member-function-signature</em></span>
+ <span class="emphasis"><em>| non-member-function-signature</em></span>
+
+<span class="emphasis"><em>member-function-signature:</em></span>
+ <span class="emphasis"><em>access-level</em></span>
+ /[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>required-template-parameter+</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span> <span class="special">(</span><span class="bold"><strong>concept</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">)</span>/]]/
+ /[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">static</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span>/]/
+ <span class="special">(</span><span class="bold"><strong>result-type</strong></span><span class="special">)</span> <span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="emphasis"><em>parameters</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="keyword">const</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="emphasis"><em>exceptions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">postcondition</span> <span class="emphasis"><em>result-assignment oldof-assignments</em></span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+
+<span class="emphasis"><em>non-member-function-signature:</em></span>
+ /[/<span class="special">(</span><span class="keyword">export</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>required-template-parameter+</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span> <span class="special">(</span><span class="bold"><strong>concept</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">)</span>/]]/
+ /[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="keyword">extern</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">static</span><span class="special">)</span>/]/
+ <span class="special">(</span><span class="bold"><strong>result-type</strong></span><span class="special">)</span> <span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="emphasis"><em>parameters</em></span> <span class="special">)</span>
+ /[/<span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="emphasis"><em>exceptions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+ /[/<span class="special">(</span><span class="identifier">postcondition</span> <span class="emphasis"><em>result-assignment oldof-assignments</em></span><span class="special">)(</span> <span class="emphasis"><em>parenthesized-assertions</em></span> <span class="special">)</span>/]/
+
+<span class="emphasis"><em>function-name:</em></span>
+ <span class="bold"><strong>non-operator-name</strong></span>
+ <span class="emphasis"><em>|</em></span> <span class="keyword">operator</span> <span class="special">(</span><span class="bold"><strong>operator-symbol</strong></span><span class="special">,</span> <span class="bold"><strong>alphanumeric-operator-name</strong></span><span class="special">)</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.postcondition_s_result_and_old_of"></a><a class="link" href="Grammar.html#contract__.Grammar.postcondition_s_result_and_old_of" title="Postcondition's Result and Old-Of">Postcondition's
+ Result and Old-Of</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>result-assignment:</em></span>
+ /[/<span class="special">(</span><span class="bold"><strong>result-variable-name</strong></span> <span class="special">=</span> <span class="keyword">return</span><span class="special">)</span>/]/
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The result assignment allows the postcondition assertions to access the
+ return value of the function using the specified result variable name.
+ </li>
+<li class="listitem">
+ The result assignment is optional and it can be specified only for non-void
+ functions.
+ </li>
+<li class="listitem">
+ This assignment requires the return type to have a copy constructor and
+ it introduces an extra copy operation to store the return value (with
+ related performance impact) -- @tdodo Can I get rid of this extra copy
+ operation passing around references to the return value?
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="emphasis"><em>oldof-assignments:</em></span>
+ <span class="special">(</span><span class="bold"><strong>oldof-variable-name</strong></span> <span class="special">=</span> CONTRACT_OLDOF<span class="special">(</span><span class="bold"><strong>oldof-expression</strong></span><span class="special">))</span><span class="emphasis"><em>*</em></span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ No type but old-of expression evaluated twice (instead of just one time
+ to make the copy).
+ </li>
+<li class="listitem">
+ The type of old-of expression must have an accessible copy constructor
+ (otherwise compile-time error).
+ </li>
+<li class="listitem">
+ <code class="computeroutput">CONTRACT_OLDOF</code>
+ macro can only be used within the old-of assignments (and not within
+ the postcondition assertions, otherwise compile-time error).
+ </li>
+<li class="listitem">
+ The old-of variable can be accessed only within the postcondition assertion
+ and only in a constant-correct context (otherwise, compile-time error).
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.positional_function_parameters"></a><a class="link" href="Grammar.html#contract__.Grammar.positional_function_parameters" title="Positional Function Parameters">Positional
+ Function Parameters</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>positional-parameters:</em></span>
+ <span class="emphasis"><em>positional-required-parameter+</em></span>
+ <span class="emphasis"><em>| positional-optional-parameter+</em></span>
+ <span class="emphasis"><em>| positional-required-parameter+ positional-optional-parameter+</em></span>
+
+<span class="emphasis"><em>positional-required-parameter:</em></span>
+ /[/<span class="special">(</span><span class="keyword">auto</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">register</span><span class="special">)</span>/]/
+ <span class="special">(</span><span class="bold"><strong>parameter-type</strong></span><span class="special">)</span> <span class="special">(</span><span class="bold"><strong>parameter-name</strong></span><span class="special">)</span>
+
+<span class="emphasis"><em>positional-optional-parameter:</em></span>
+ <span class="emphasis"><em>required-parameter</em></span>
+ <span class="special">(</span><span class="keyword">default</span><span class="special">)(</span><span class="bold"><strong>parameter-default</strong></span><span class="special">)</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.named_function_parameters"></a><a class="link" href="Grammar.html#contract__.Grammar.named_function_parameters" title="Named Function Parameters">Named Function
+ Parameters</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>named-parameters:</em></span>
+ /[/<span class="special">(</span><span class="keyword">namespace</span><span class="special">)(</span><span class="bold"><strong>tag-namespace</strong></span><span class="special">)</span>/]/
+ <span class="emphasis"><em>induced-named-parameters</em></span>
+ <span class="emphasis"><em>| deduced-named-parameters</em></span>
+ <span class="emphasis"><em>| induced-named-parameters deduced-named-parameters</em></span>
+
+<span class="emphasis"><em>induced-named-parameters:</em></span>
+ <span class="emphasis"><em>required-named-parameter+</em></span>
+ <span class="emphasis"><em>| optional-named-parameter+</em></span>
+ <span class="emphasis"><em>| required-named-parameter+ optional-named-parameter+</em></span>
+
+<span class="emphasis"><em>deduced-named-parameters:</em></span>
+ <span class="special">(</span><span class="identifier">deduce</span><span class="special">)(</span> <span class="emphasis"><em>induced-named-parameters</em></span> <span class="special">)</span>
+
+<span class="emphasis"><em>required-named-parameter:</em></span>
+ <span class="emphasis"><em>inout-classifier</em></span>
+ <span class="emphasis"><em>named-parameter-type</em></span> <span class="special">(</span><span class="bold"><strong>parameter-name</strong></span><span class="special">)</span>
+
+<span class="emphasis"><em>optional-named-parameter:</em></span>
+ <span class="emphasis"><em>required-named-parameter</em></span>
+ <span class="special">(</span><span class="keyword">default</span><span class="special">)(</span><span class="bold"><strong>parameter-default</strong></span><span class="special">)</span>
+
+<span class="emphasis"><em>inout-classifier:</em></span>
+ <span class="special">(</span><span class="identifier">in</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="identifier">out</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="identifier">inout</span><span class="special">)</span>
+
+<span class="emphasis"><em>named-parameter-type:</em></span>
+ <span class="special">(</span><span class="keyword">auto</span><span class="special">)</span> <span class="comment">// Any type.</span>
+ <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="bold"><strong>parameter-type</strong></span><span class="special">)</span> <span class="comment">// Only the exact type specification.</span>
+ <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="identifier">requires</span> <span class="special">(</span><span class="bold"><strong>parameter-type-predicate</strong></span><span class="special">))</span> <span class="comment">// Any type matching the specified predicate.</span>
+</pre>
+<p>
+ If the tag-namespace is not specified, <code class="literal"><span class="emphasis"><em>current-namespace</em></span>::tag</code>
+ is used by default.
+ </p>
+<p>
+ Named parameters cannot be specified for function templates. Note that this
+ is not a limitation because named parameters specified to match any type
+ using <code class="computeroutput"><span class="special">(</span><span class="keyword">auto</span><span class="special">)</span></code> are equivalent to template parameters. Furthermore,
+ named parameters specified to match a parameter type predicate using <code class="computeroutput"><span class="special">(</span><span class="identifier">requires</span> <span class="special">(</span> <span class="special">...</span> <span class="special">))</span></code>
+ are equivalent to template parameters with concept requirements.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.template_parameters"></a><a class="link" href="Grammar.html#contract__.Grammar.template_parameters" title="Template Parameters">Template Parameters</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>template-parameters:</em></span>
+ <span class="emphasis"><em>required-template-parameter+</em></span>
+ <span class="emphasis"><em>| optional-template-parameter+</em></span>
+ <span class="emphasis"><em>| required-template-parameter+ optional-template-parameter+</em></span>
+
+<span class="emphasis"><em>required-template-parameter:</em></span>
+ <span class="emphasis"><em>template-parameter-kind</em></span> <span class="special">(</span><span class="bold"><strong>template-parameter-name</strong></span><span class="special">)</span>
+
+<span class="emphasis"><em>template-parameter-kind:</em></span>
+ <span class="special">(</span><span class="keyword">typename</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="comment">// For type template parameters.</span>
+ <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="bold"><strong>template-parameter-type</strong></span><span class="special">)</span> <span class="comment">// For value template parameters.</span>
+
+<span class="emphasis"><em>optional-template-parameter:</em></span>
+ <span class="emphasis"><em>required-template-parameter</em></span>
+ <span class="special">(</span><span class="keyword">default</span><span class="special">)(</span><span class="bold"><strong>template-parameter-default</strong></span><span class="special">)</span>
+</pre>
+<p>
+ As usual in C++, template parameters with defaults must appear at the end
+ of the template parameter list and they cannot be specified for function
+ templates.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.assertions"></a><a class="link" href="Grammar.html#contract__.Grammar.assertions" title="Assertions">Assertions</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-assertions:</em></span>
+ <span class="emphasis"><em>parenthesized-assertion+</em></span>
+
+<span class="emphasis"><em>parenthesized-assertion:</em></span>
+ <span class="emphasis"><em>runtime-assertion</em></span>
+ <span class="emphasis"><em>| static-assertion</em></span>
+
+<span class="emphasis"><em>runtime-assertion:</em></span>
+ <span class="emphasis"><em>assertion</em></span>
+ <span class="emphasis"><em>| constant-assertion</em></span>
+ <span class="emphasis"><em>| conditional-assertion</em></span>
+
+<span class="emphasis"><em>assertion:</em></span>
+ <span class="special">(</span><span class="bold"><strong>boolean-expression</strong></span><span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">importance</span> <span class="special">(</span><span class="bold"><strong>natural-number</strong></span><span class="special">))</span>/]/
+
+<span class="comment">// Only the specified variable names can be used to assert the condition and they must be used in as constants.</span>
+<span class="emphasis"><em>constant-assertion:</em></span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="bold"><strong>in-scope-variable-name</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">(</span><span class="bold"><strong>constant-boolean-expression</strong></span><span class="special">))</span>
+ /[/<span class="special">(</span><span class="identifier">importance</span> <span class="special">(</span><span class="bold"><strong>natural-number</strong></span><span class="special">))</span>/]/
+
+<span class="emphasis"><em>conditional-assertion:</em></span>
+ <span class="special">(</span><span class="keyword">if</span> <span class="special">(</span><span class="bold"><strong>boolean-expression</strong></span><span class="special">)</span> <span class="special">(</span>
+ <span class="emphasis"><em>runtime-assertion+</em></span>
+ <span class="special">))</span>
+ /[/<span class="special">(</span><span class="keyword">else</span> <span class="special">(</span> <span class="comment">// This parenthesized else statement is optional.</span>
+ <span class="emphasis"><em>runtime-assertion+</em></span>
+ <span class="special">))</span>/]/
+
+<span class="emphasis"><em>static-assertion:</em></span>
+ <span class="special">(</span><span class="keyword">static</span> <span class="special">(</span><span class="bold"><strong>static-boolean-expression</strong></span><span class="special">))</span>
+ /[/<span class="special">(</span><span class="identifier">importance</span> <span class="special">(</span><span class="bold"><strong>natural-number</strong></span><span class="special">))</span>/]/
+</pre>
+<p>
+ Note that the boolean condition of the if-statement of a conditional-assertion
+ is not evaluated in constant-correct context for loop invariants. This limitation
+ could have been removed by allowing conditional-assertions to be specified
+ within a constant-assertion however that would complicate the syntax significantly
+ making conditional-assertions within constant-assertions very hard to read
+ and creating confusion when importance is specified in both the inner assertions
+ within the conditional-assertion and the outer constant-assertion. Therefore,
+ constant-assertions only allow to specify a single boolean expression. However,
+ the <code class="computeroutput"><span class="special">?:</span></code> operator can be used
+ within a constant-assertion to check the if-condition in a constant correct
+ context:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="identifier">x</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span> <span class="special">?</span> <span class="identifier">x</span> <span class="special">></span> <span class="number">0</span> <span class="special">:</span> <span class="identifier">x</span> <span class="special"><</span> <span class="number">0</span><span class="special">))</span>
+</pre>
+<p>
+ The downside of this approach is that the if-condition will have to be repeated
+ multiple times (with some lost in performance) for different constant-assertions
+ when they need to be wrapped by the same if-condition:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="identifier">x</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span> <span class="special">?</span> <span class="identifier">x</span> <span class="special">></span> <span class="number">0</span> <span class="special">:</span> <span class="identifier">x</span> <span class="special"><</span> <span class="number">0</span><span class="special">))</span>
+<span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="identifier">x</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span> <span class="special">?</span> <span class="identifier">y</span> <span class="special">></span> <span class="number">0</span> <span class="special">:</span> <span class="identifier">y</span> <span class="special"><</span> <span class="number">0</span><span class="special">))</span> <span class="comment">// Checking `x == y` a second time...</span>
+</pre>
+<p>
+ Alternatively, the multiple assertion conditions can be joined in <code class="computeroutput"><span class="special">&&</span></code> so to be checked within the same
+ <code class="computeroutput"><span class="special">?:</span></code> operator:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="identifier">x</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="identifier">y</span> <span class="special">?</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">></span> <span class="number">0</span> <span class="special">&&</span> <span class="identifier">y</span> <span class="special">></span> <span class="number">0</span><span class="special">)</span> <span class="special">:</span> <span class="special">(</span><span class="identifier">x</span> <span class="special"><</span> <span class="number">0</span> <span class="special">&&</span> <span class="identifier">y</span> <span class="special"><</span> <span class="number">0</span><span class="speci
al">)))</span> <span class="comment">// Cannot see which of the two conditions in and is failing...</span>
+</pre>
+<p>
+ The downside in this case is that if the asserted condition fails it is not
+ clear which one of the two anded condition actually failed.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.loop_variant"></a><a class="link" href="Grammar.html#contract__.Grammar.loop_variant" title="Loop Variant">Loop Variant</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="emphasis"><em>parenthesized-variant:</em></span>
+ <span class="emphasis"><em>variant</em></span>
+ <span class="emphasis"><em>| constant-variant</em></span>
+
+<span class="emphasis"><em>variant:</em></span>
+ <span class="special">(</span><span class="bold"><strong>decreasing-natural-expression</strong></span><span class="special">)</span>
+ /[/<span class="special">(</span><span class="identifier">importance</span> <span class="special">(</span><span class="bold"><strong>natural-number</strong></span><span class="special">))</span>/]/
+
+<span class="emphasis"><em>constant-variant:</em></span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="special">(</span><span class="bold"><strong>in-scope-variable-name</strong></span><span class="special">)</span><span class="emphasis"><em>+</em></span> <span class="special">(</span><span class="bold"><strong>constant-decreasing-natural-expression</strong></span><span class="special">))</span>
+ /[/<span class="special">(</span><span class="identifier">importance</span> <span class="special">(</span><span class="bold"><strong>natural-number</strong></span><span class="special">))</span>/]/
+</pre>
+<p>
+ By definition, a variant expression can never be static because it must monotonically
+ decrease at run-time (that is why there is no static-variant).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.Grammar.new_keywords"></a><a class="link" href="Grammar.html#contract__.Grammar.new_keywords" title="New Keywords">New Keywords</a>
+</h3></div></div></div>
+<div class="table">
+<a name="id956430"></a><p class="title"><b>Table 2. Keywords replacing C++ non alphanumeric symbols.</b></p>
+<div class="table-contents"><table class="table" summary="Keywords replacing C++ non alphanumeric symbols.">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parenthesized Keyword
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">extends</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify base classes instead
+ of the usual C++ symbol <code class="computeroutput"><span class="special">:</span></code>.
+ The "extends" word was chosen because it is alphanumeric
+ and already used by Java.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">initialize</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">default</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify defaults for function
+ and template parameters instead of the usual C++ symbol <code class="computeroutput"><span class="special">=</span></code>. The "default" word
+ was chose because it is alphanumeric and it is already a C++ keyword
+ (used to specify default action within a <code class="computeroutput"><span class="keyword">switch</span></code>
+ statement).
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ In addition to the usual C++ contexts where <code class="computeroutput"><span class="keyword">void</span></code>
+ is used, this parenthesized keyword is used to specify a function
+ that takes no parameter (instead of <code class="literal"><span class="bold"><strong>function-name</strong></span>()</code>),
+ a function that does not throw (instead of the exeception specification
+ <code class="computeroutput"><span class="keyword">throw</span><span class="special">()</span></code>),
+ no result within postconditions for a function with a type expression
+ not using the <code class="computeroutput"><span class="keyword">void</span></code>
+ token but evaluating to the <code class="computeroutput"><span class="keyword">void</span></code>
+ type.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<br class="table-break"><div class="table">
+<a name="id956742"></a><p class="title"><b>Table 3. Keywords for new features.</b></p>
+<div class="table-contents"><table class="table" summary="Keywords for new features.">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parenthesized Keyword
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">importance</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify assertion importance.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">static</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">const</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">if</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">else</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">namespace</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify the tag namespace
+ where named parameter classes are defined.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">deduce</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify a list of deduced
+ named parameters.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">in</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">out</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">inout</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">auto</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">requires</span>
+ <span class="special">...)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ This parenthesized keyword is used to specify template parameter
+ concepts using the syntax <code class="computeroutput"><span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span>
+ <span class="special">(</span></code><code class="literal"><span class="bold"><strong>concept</strong></span></code><code class="computeroutput"><span class="special">)</span></code><code class="literal"><span class="emphasis"><em>+</em></span></code><code class="computeroutput">
+ <span class="special">)</span></code>. It is also similarly
+ used to specify type constraints for named parameters using the
+ syntax <code class="computeroutput"><span class="special">(</span><span class="identifier">requires</span>
+ <span class="special">(</span></code><code class="literal"><span class="bold"><strong>parameter-type-predicate</strong></span></code><code class="computeroutput"><span class="special">))</span></code>.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<br class="table-break">
+</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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract_programming.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/license.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/license.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>License</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="bibliography.html" title="Bibliography">
+<link rel="next" href="release_history.html" title="Release History">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="bibliography.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="release_history.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.license"></a><a class="link" href="license.html" title="License">License</a>
+</h2></div></div></div>
+<pre class="programlisting">Copyright (C) 2009-2010 Lorenzo Caminiti.
+Use, modification, and distribution is subject to the
+Contract++ Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt.)
+</pre>
+<pre class="programlisting">(File: LICENSE_1_0.txt)
+
+Contract Programming for C++ (Contract++) Software License, Version 1.0
+April 19th, 2009
+
+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.
+</pre>
+</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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="bibliography.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="release_history.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/release_history.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/release_history.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,191 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Release History</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="license.html" title="License">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="license.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.release_history"></a><a class="link" href="release_history.html" title="Release History">Release History</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Release <NEXT></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_3_490__2010_03_07_">Release
+ 0.3.490 (2010-03-07)</a></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_3_469__2010_02_21_">Release
+ 0.3.469 (2010-02-21)</a></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_2_190__2009_11_21_">Release
+ 0.2.190 (2009-11-21)</a></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_1_26__2009_06_17_">Release
+ 0.1.26 (2009-06-17)</a></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_1_55__2009_04_19_">Release
+ 0.1.55 (2009-04-19)</a></span></dt>
+<dt><span class="section"><a href="release_history.html#contract__.release_history.release_0_1_50__2009_04_19_">Release
+ 0.1.50 (2009-04-19)</a></span></dt>
+</dl></div>
+<p>
+ List of releases from the newest to the oldest.
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>release-number</em></span> := <span class="emphasis"><em>major</em></span>.<span class="emphasis"><em>minor</em></span>.<span class="emphasis"><em>subversion-revision</em></span>
+</pre>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release__next_"></a><a class="link" href="release_history.html#contract__.release_history.release__next_" title="Release <NEXT>">Release <NEXT></a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+ Bugfix: Contract macros did not repeat volatile in old object argument
+ of postconditions when volatile object was tagged copyable. Added examples
+ and docs on how to handle old values for volatile types -- programmers
+ must provide T(const volatileT&) const-correct copy constructor for
+ volatile type and then contract::copy automatically uses it.
+ </li></ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_3_490__2010_03_07_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_3_490__2010_03_07_" title="Release 0.3.490 (2010-03-07)">Release
+ 0.3.490 (2010-03-07)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Added support and examples for <code class="computeroutput"><span class="keyword">volatile</span></code>,
+ <code class="computeroutput"><span class="keyword">auto</span></code>, <code class="computeroutput"><span class="keyword">explicit</span></code>,
+ <code class="computeroutput"><span class="keyword">export</span></code>, <code class="computeroutput"><span class="keyword">extern</span></code>,
+ <code class="computeroutput"><span class="keyword">friend</span></code>, <code class="computeroutput"><span class="keyword">inline</span></code>,
+ <code class="computeroutput"><span class="keyword">struct</span></code>, and <code class="computeroutput"><span class="keyword">throw</span></code> (for exception specifications).
+ </li>
+<li class="listitem">
+ Documented that <code class="computeroutput"><span class="keyword">union</span></code> cannot
+ be contracted.
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_3_469__2010_02_21_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_3_469__2010_02_21_" title="Release 0.3.469 (2010-02-21)">Release
+ 0.3.469 (2010-02-21)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Removed use of <code class="computeroutput"><span class="identifier">self</span></code>,
+ <span class="emphasis"><em>variable</em></span><code class="computeroutput"><span class="special">.</span><span class="identifier">now</span></code>, and <span class="emphasis"><em>variable</em></span><code class="computeroutput"><span class="special">.</span><span class="identifier">old</span></code>
+ in writing contracts. Object (this) and variables are now accessed as
+ usual in member functions. <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span></code><span class="emphasis"><em>variable</em></span><code class="computeroutput"><span class="special">)</span></code> is used to access old values in postconditions.
+ </li>
+<li class="listitem">
+ Added <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span></code>, <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span></code>,
+ and <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)</span></code> to specify contracts within the function
+ signature sequence. If no preconditions then <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span>
+ <span class="special">({...})</span></code> is simply omitted from
+ <code class="computeroutput"><span class="identifier">sequence</span></code> (same for postconditions,
+ body is mandatory instead). For non-void functions, user can name the
+ result argument with <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span></code><span class="emphasis"><em>result-name</em></span><code class="computeroutput"><span class="special">)</span> <span class="special">({...})</span></code>.
+ </li>
+<li class="listitem">
+ Changed contract class template to use same syntax as Boost.Function
+ (i.e., <code class="computeroutput"><span class="identifier">F</span></code> function type).
+ </li>
+<li class="listitem">
+ Added support for non-member and static functions.
+ </li>
+<li class="listitem">
+ Added support for subcontracting with multiple inheritance.
+ </li>
+<li class="listitem">
+ Added static class invariants which are always checked (also at constructors
+ entry, destructor exit, and by static member functions).
+ </li>
+<li class="listitem">
+ Added block invariants and Eiffel-like loop variants.
+ </li>
+<li class="listitem">
+ Added functions to customize action on contract failure (default to
+ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code>).
+ </li>
+<li class="listitem">
+ Removed feature for automatic contract documentation using Doxygen (this
+ is not compatible with added <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span></code>,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span></code>, and <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)</span></code>
+ because Doxygen preprocessor is not intended to handle Boost.Preprocessor
+ sequences).
+ </li>
+<li class="listitem">
+ Rewritten entire documentation (now using Boost.QuickBook instead of
+ Doxygen).
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_2_190__2009_11_21_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_2_190__2009_11_21_" title="Release 0.2.190 (2009-11-21)">Release
+ 0.2.190 (2009-11-21)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Compiled on both GCC (Linux and Cygwin) and Microsoft Visual C++ (Windows
+ XP).
+ </li>
+<li class="listitem">
+ Required to use <code class="computeroutput"><span class="keyword">void</span></code> to
+ specify empty function argument list. This is to comply with C++ ISO
+ standard that does not allow to pass empty macro parameters so it does
+ not support empty preprocessor sequence elements <code class="computeroutput"><span class="special">()</span></code>.
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_1_26__2009_06_17_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_1_26__2009_06_17_" title="Release 0.1.26 (2009-06-17)">Release
+ 0.1.26 (2009-06-17)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+ Completed first documentation draft.
+ </li></ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_1_55__2009_04_19_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_1_55__2009_04_19_" title="Release 0.1.55 (2009-04-19)">Release
+ 0.1.55 (2009-04-19)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Reorganized files to cleanup root directory.
+ </li>
+<li class="listitem">
+ Added installation program.
+ </li>
+</ol></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.release_history.release_0_1_50__2009_04_19_"></a><a class="link" href="release_history.html#contract__.release_history.release_0_1_50__2009_04_19_" title="Release 0.1.50 (2009-04-19)">Release
+ 0.1.50 (2009-04-19)</a>
+</h3></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+ First public release.
+ </li></ol></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="license.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/throw_on_failure.html
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/throw_on_failure.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,144 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Annex: Throw on Failure</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="examples.html" title="Examples">
+<link rel="next" href="contract_programming.html" title="Annex: Contract Programming">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="examples.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="contract_programming.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.throw_on_failure"></a><a class="link" href="throw_on_failure.html" title="Annex: Throw on Failure">Annex: Throw on Failure</a>
+</h2></div></div></div>
+<p>
+ This example shows how to setup the library to throw exceptions on contract
+ condition failure (overriding the library default behaviour to call <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code> to handle contract failures).
+ </p>
+<p>
+ Specifically:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Any exception (including user defined ones) that is thrown when checking
+ a contract condition is re-thrown by the contract failure handlers defined
+ below.
+ </li>
+<li class="listitem">
+ However, if a contract condition fails from a destructor, exceptions cannot
+ be thrown (to comply with C++ STL exception safety requirements) so a message
+ is logged to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span></code> and the program execution continues.
+ <sup>[<a name="id948581" href="#ftn.id948581" class="footnote">18</a>]</sup>
+ </li>
+<li class="listitem">
+ In addition, the postcondition failure handler catches any exception derived
+ from <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span></code> to print the exception description
+ <code class="computeroutput"><span class="identifier">what</span><span class="special">()</span></code>
+ on <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span></code> before re-throwing it (this is to
+ show how the contract failure handlers can selectively catch exceptions).
+ </li>
+</ol></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</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">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="comment">// User defined exception (not even derived from `std::exception`).</span>
+<span class="keyword">class</span> <span class="identifier">not_a_number</span> <span class="special">{};</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">(</span><span class="identifier">sqrt</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span>
+ <span class="comment">// Throw user-defined exception if contract is broken.</span>
+ <span class="special">(</span><span class="identifier">x</span> <span class="special">>=</span> <span class="number">0.0</span> <span class="special">?</span> <span class="keyword">true</span> <span class="special">:</span> <span class="keyword">throw</span> <span class="identifier">not_a_number</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">root</span><span class="special">)(</span>
+ <span class="comment">// Defatul throws library defined exception `contract::failure`.</span>
+ <span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">root</span> <span class="special">*</span> <span class="identifier">root</span><span class="special">))</span>
+ <span class="special">)</span>
+<span class="special">({</span>
+ <span class="keyword">return</span> <span class="number">0.0</span><span class="special">;</span> <span class="comment">// Intentionally incorrect to fail postcondition.</span>
+<span class="special">})</span> <span class="special">)</span>
+
+<span class="comment">// Handler that re-throws contract broken exception instead of terminating.</span>
+<span class="keyword">void</span> <span class="identifier">throwing_handler</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">from</span><span class="special">&</span> <span class="identifier">context</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">context</span> <span class="special">==</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">FROM_DESTRUCTOR</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Cannot throw from within destructor for STL exception safety.</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Ignored destructor contract failure"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">else</span> <span class="special">{</span>
+ <span class="comment">// Failure handlers always called with active an exception.</span>
+ <span class="keyword">throw</span><span class="special">;</span> <span class="comment">// Re-throw active exception thrown by precondition.</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+
+<span class="comment">// Handler showing how to catch contract broken exception.</span>
+<span class="keyword">void</span> <span class="identifier">postcondition_throwing_handler</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">from</span><span class="special">&</span> <span class="identifier">context</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// try/catch/re-throw to get active exception (for logging, etc.).</span>
+ <span class="keyword">try</span> <span class="special">{</span>
+ <span class="keyword">throw</span><span class="special">;</span> <span class="comment">// Re-throw active exception thrown by precondition.</span>
+ <span class="special">}</span> <span class="keyword">catch</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">&</span> <span class="identifier">error</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Get exception object.</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Throwing '"</span> <span class="special"><<</span> <span class="identifier">error</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"'"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">throw</span><span class="special">;</span> <span class="comment">// Re-throw active exception thrown by precondition.</span>
+ <span class="special">}</span> <span class="comment">// Non standard exception also thrown.</span>
+<span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="comment">// Setup contract failure handlers that throw (instead of terminate).</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">set_precondition_broken</span><span class="special">(&</span><span class="identifier">throwing_handler</span><span class="special">);</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">set_postcondition_broken</span><span class="special">(&</span><span class="identifier">postcondition_throwing_handler</span><span class="special">);</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">set_class_invariant_broken</span><span class="special">(&</span><span class="identifier">throwing_handler</span><span class="special">);</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">set_block_invariant_broken</span><span class="special">(&</span><span class="identifier">throwing_handler</span><span class="special">);</span>
+
+ <span class="keyword">try</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(-</span><span class="number">1.0</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">catch</span> <span class="special">(</span><span class="identifier">not_a_number</span><span class="special">&)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Ignored not a number exception"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">try</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="number">4.0</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span> <span class="keyword">catch</span> <span class="special">(...)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special"><<</span> <span class="string">"Unable to calculate square root"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">return</span> <span class="identifier">EXIT_SUCCESS</span><span class="special">;</span>
+<span class="special">}</span>
+
+</pre>
+<p>
+ </p>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id948581" href="#id948581" class="para">18</a>] </sup>
+ Continuing the program in this case assumes that the destructors body
+ will be able to somehow execute correctly even if the class invariants
+ do not hold true. This is usually <span class="emphasis"><em>not</em></span> a safe assumption
+ and it is made here only for simplicity. You could chose to still terminate
+ in case class invariants fail for a destructor or to attempt to recover
+ from such an error in some other, more sophisticated, way.
+ </p></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="examples.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="contract_programming.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/contract/libs/contract/doc/html/contract__/todo.html
Added: sandbox/contract/libs/contract/doc/html/contract__/tutorial.html
Added: sandbox/contract/libs/contract/doc/html/contract__/without_the_macros.html
Added: sandbox/contract/libs/contract/doc/html/doc/html/boostbook.css
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/alert.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/blank.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/caution.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/draft.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/home.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/important.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/next.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/next_disabled.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/note.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/prev.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/prev_disabled.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/smiley.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/tip.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/toc-blank.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/toc-minus.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/toc-plus.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/up.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/up_disabled.png
Added: sandbox/contract/libs/contract/doc/html/doc/html/images/warning.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/1.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/10.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/11.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/12.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/13.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/14.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/15.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/2.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/3.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/4.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/5.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/6.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/7.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/8.png
Added: sandbox/contract/libs/contract/doc/html/doc/src/images/callouts/9.png
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/block/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/circle/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/factorial/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/equal.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/not_equal.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/sqrt/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Crowl2006/vector/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Makefile
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/gcd/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/maxarray/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/stack3.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/stack4.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/counter.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/decrement_button.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/push_button.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/view_of_counter.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/dictionary.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/observe.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/simple_queue.hpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/stack.hpp
Added: sandbox/contract/libs/contract/doc/html/example/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.cpp
Added: sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.hpp
Added: sandbox/contract/libs/contract/doc/html/example/commas/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/commas/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/cv/REAME.txt
Added: sandbox/contract/libs/contract/doc/html/example/cv/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/exspecs/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/exspecs/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/extern/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/extern/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/friend/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/friend/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/inline/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/inline/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/myvector/basic_begin.hpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/boundable.hpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/main_nomacros.cpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/myvector.hpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/myvector_nomacros.hpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/push_back.cpp
Added: sandbox/contract/libs/contract/doc/html/example/myvector/pushable.hpp
Added: sandbox/contract/libs/contract/doc/html/example/storage/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/storage/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/struct/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/struct/main.cpp
Added: sandbox/contract/libs/contract/doc/html/example/throw/README.txt
Added: sandbox/contract/libs/contract/doc/html/example/throw/main.cpp
Added: sandbox/contract/libs/contract/doc/html/images/alert.png
Added: sandbox/contract/libs/contract/doc/html/images/blank.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/1.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/10.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/11.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/12.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/13.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/14.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/15.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/2.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/3.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/4.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/5.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/6.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/7.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/8.png
Added: sandbox/contract/libs/contract/doc/html/images/callouts/9.png
Added: sandbox/contract/libs/contract/doc/html/images/caution.png
Added: sandbox/contract/libs/contract/doc/html/images/draft.png
Added: sandbox/contract/libs/contract/doc/html/images/home.png
Added: sandbox/contract/libs/contract/doc/html/images/important.png
Added: sandbox/contract/libs/contract/doc/html/images/next.png
Added: sandbox/contract/libs/contract/doc/html/images/next_disabled.png
Added: sandbox/contract/libs/contract/doc/html/images/note.png
Added: sandbox/contract/libs/contract/doc/html/images/prev.png
Added: sandbox/contract/libs/contract/doc/html/images/prev_disabled.png
Added: sandbox/contract/libs/contract/doc/html/images/smiley.png
Added: sandbox/contract/libs/contract/doc/html/images/tip.png
Added: sandbox/contract/libs/contract/doc/html/images/toc-blank.png
Added: sandbox/contract/libs/contract/doc/html/images/toc-minus.png
Added: sandbox/contract/libs/contract/doc/html/images/toc-plus.png
Added: sandbox/contract/libs/contract/doc/html/images/up.png
Added: sandbox/contract/libs/contract/doc/html/images/up_disabled.png
Added: sandbox/contract/libs/contract/doc/html/images/warning.png
Added: sandbox/contract/libs/contract/doc/html/index.html
Added: sandbox/contract/libs/contract/doc/html/reference.html
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/todo.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,881 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>TODO</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
+<link rel="start" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="release_history.html" title="Release History">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="release_history.html"><img src=".././doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src=".././doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src=".././doc/html/images/home.png" alt="Home"></a>
+</div>
+<hr>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.todo"></a><a class="link" href="todo.html" title="TODO">TODO</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="todo.html#contract__.todo.improve_contract_macros__sequence__error_detection_and_reporting">Improve
+ contract macros <code class="computeroutput"><span class="identifier">sequence</span></code> error
+ detection and reporting</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.can_block_invariants_and_loop_variants_be_made_constant_correct_">Can
+ block invariants and loop variants be made constant-correct?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.improve_compile_time_performances">Improve
+ compile-time performances</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.analyze_run_time_performances">Analyze
+ run-time performances</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.always_check_contract_assertion_syntax">Always
+ check contract assertion syntax</a></span></dt>
+<dt><span class="section">Support concurrency</span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.can_constructor_member_initialization_list_limitation_be_removed_">Can
+ constructor member initialization list limitation be removed?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.should_preconditions_be_checked_before_constructor_member_initialization_list_">Should
+ preconditions be checked before constructor member initialization list?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.can_syntax_of_contract_macros_be_unified_with_other_boost_libraries_">Can
+ syntax of contract macros be unified with other Boost libraries?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.consider_allowing_optional_contract_checking_based_on_assertion_importance_and_or_class_name">Consider
+ allowing optional contract checking based on assertion importance and/or class
+ name</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.consider_adding_contracts_to_all_stl_classes_and_functions_in__contract__std___">Consider
+ adding contracts to all STL classes and functions in <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span></code></a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.should_i_provide__contract_xyz_decl____macros_">Should
+ I provide <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> macros?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.shall_i_remove_the__assert____macros_">Shall
+ I remove the <code class="computeroutput"><span class="identifier">ASSERT</span><span class="special">()</span></code>
+ macros?</a></span></dt>
+<dt><span class="section"><a href="todo.html#contract__.todo.fusing_contracts__concepts__named_parameters__etc_">Fusing
+ contracts, concepts, named parameters, etc.</a></span></dt>
+</dl></div>
+<p>
+ This section lists open items under consideration for future development of
+ this library. It is mainly intended as a memorandum for the library authors.
+ </p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.improve_contract_macros__sequence__error_detection_and_reporting"></a><a class="link" href="todo.html#contract__.todo.improve_contract_macros__sequence__error_detection_and_reporting" title="Improve contract macros sequence error detection and reporting">Improve
+ contract macros <code class="computeroutput"><span class="identifier">sequence</span></code> error
+ detection and reporting</a>
+</h3></div></div></div>
+<p>
+ The current implementation for syntax error detection and reporting for the
+ <code class="computeroutput"><span class="identifier">sequence</span></code> parameter of the
+ contract macros should be improved.
+ </p>
+<p>
+ For example, if I forget the sequence element for the result type <code class="computeroutput"><span class="special">(</span><span class="identifier">result</span><span class="special">-</span><span class="identifier">type</span><span class="special">)</span></code>,
+ the preprocessor gives a ton of errors most of which are about Boost.Preprocessor
+ internal macros and make no sense to the user. While using the C++ preprocessor
+ imposes some fundamental limitations on the amount of syntax checking I can
+ implement for the <code class="computeroutput"><span class="identifier">sequence</span></code>
+ macro parameter, I should be able to improve the current library implementation.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.can_block_invariants_and_loop_variants_be_made_constant_correct_"></a><a class="link" href="todo.html#contract__.todo.can_block_invariants_and_loop_variants_be_made_constant_correct_" title="Can block invariants and loop variants be made constant-correct?">Can
+ block invariants and loop variants be made constant-correct?</a>
+</h3></div></div></div>
+<p>
+ Currently block invariants and loop variants are <span class="emphasis"><em>not</em></span>
+ constant-correct. Class invariants, preconditions, and postconditions instead
+ are constant-correct so to ensure that the state of the system is not changed
+ while checking the contract.
+ </p>
+<p>
+ Can block invariants and loop variants be made constant-correct also?
+ </p>
+<p>
+ This seems difficult because C++ does not allow to specify "constant-block":
+ </p>
+<pre class="programlisting"><span class="special">{</span> <span class="comment">// Some existing block.
+</span> <span class="keyword">const</span> <span class="special">{</span> <span class="comment">// A constant block -- BUT NOT SUPPORTED!!
+</span> <span class="comment">// Assert here block invariants and loop variants ensuring
+</span> <span class="comment">// const correctness.
+</span> <span class="special">...</span>
+ <span class="special">}</span>
+ <span class="special">...</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Therefore, the code asserting block invariants and loop variants has the
+ same constant constraints (possibly none!) on object, function arguments,
+ result, etc as the enclosing code block... Is there a way around this? If
+ not, shall I still provide block invariants and loop variants (documenting
+ this limitation) or not?
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.improve_compile_time_performances"></a><a class="link" href="todo.html#contract__.todo.improve_compile_time_performances" title="Improve compile-time performances">Improve
+ compile-time performances</a>
+</h3></div></div></div>
+<p>
+ The library significantly increases compile-time (and compiler memory usage)
+ when compiling the code with contracts turned on, compared with compilation
+ with contracts off. Investigate what is stressing compiler performances and
+ see if the library implementation can be optimized to improve compile-time
+ performances.
+ </p>
+<p>
+ The baseline should be compilation with all contracts turned off. There might
+ be different reasons for the increased compilation-time/memory:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Contract assertions are programmed in header files so they are recompiled
+ for each translation unit. I can test the effect of this by disabling pre/postcondition
+ compilation (so the library contract templates will still be compiled by
+ the user contracts will compile much less code in the header files because
+ there will be no pre/postcondition).
+ </li>
+<li>
+ The preprocessing time needed for the contract macros expansion and to
+ parse the <code class="computeroutput"><span class="identifier">sequence</span></code> macro
+ parameter. I can check this by stopping compilation after preprocessing
+ (<code class="computeroutput"><span class="special">-</span><span class="identifier">E</span></code>
+ compiler option) and measure how long preprocessing takes compared with
+ compilation.
+ </li>
+<li>
+ The library uses quite a bit of template metaprogramming (metafunctions,
+ etc). See how the compile-time effects of template metaprogramming were
+ analyzed for the Boost.MSM library and performance a similar analysis for
+ this library. Also study carefully the chapter on compile-time performances
+ of the Boost.MPL book.
+ </li>
+<li>
+ The library is intentionally making all the contract classes always templates
+ (using the artificial <code class="computeroutput"><span class="identifier">ZERO</span></code>
+ template argument so the library can internally use <code class="computeroutput"><span class="keyword">template</span><span class="special">/</span><span class="keyword">typename</span></code>
+ keywords regardless of the template context). What is the compile-time
+ effect of these extra contract template classes compared with the effect
+ if they have not been made templates using <code class="computeroutput"><span class="identifier">ZERO</span></code>?
+ <code class="computeroutput"><span class="identifier">ZERO</span></code> can be removed and
+ contract classes (for non-template functions) can be made non-template
+ but this comes at the cost of having the user specify <code class="computeroutput"><span class="special">(</span><span class="keyword">template</span><span class="special">)</span></code>
+ instead of <code class="computeroutput"><span class="special">(</span><span class="keyword">class</span><span class="special">)</span></code> for template classes (this complicates
+ the <code class="computeroutput"><span class="identifier">sequence</span></code> syntax) --
+ so the <code class="computeroutput"><span class="identifier">ZERO</span></code> workaround
+ should be removed only if there is evidence that it will help compile-time.
+ </li>
+<li>
+ More?
+ </li>
+</ol></div>
+<p>
+ Ultimately, this analysis should be added to the documentation.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.analyze_run_time_performances"></a><a class="link" href="todo.html#contract__.todo.analyze_run_time_performances" title="Analyze run-time performances">Analyze
+ run-time performances</a>
+</h3></div></div></div>
+<p>
+ Provide some data to show run-time performances of contract checking -- the
+ baseline should be run-time performance with all contracts turned off.
+ </p>
+<p>
+ The library current implementation should be optimized to minimize run-time
+ overhead of contract checking. Preliminary data shows that the library run-time
+ performance impact (execution time, CPU usage, and memory usage) is acceptable.
+ However, data should be systematically collected and analyzed to verify this
+ (and then added to the documentation).
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.always_check_contract_assertion_syntax"></a><a class="link" href="todo.html#contract__.todo.always_check_contract_assertion_syntax" title="Always check contract assertion syntax">Always
+ check contract assertion syntax</a>
+</h3></div></div></div>
+<p>
+ If the precondition, postcondition, and invariant (dynamic and static) functions
+ are always left in the code, they are compiled and their assertions are check
+ for syntax errors. If they are not called, they add no run-time and/or object-size
+ overhead -- see the "test/check" analysis. The contract class should
+ be removed form the code instead when there is no contract and it should
+ only have pre/post when these are checked.
+ </p>
+<p>
+ A configuration macro <code class="computeroutput"><span class="identifier">CONTRACT_CONFIG_ALWAYS_CHECK_ASSERTION_SYNTAX</span></code>,
+ with default value 1, can be provided for programmers to disable assertion
+ syntax checking in order to reduce compilation time.
+ </p>
+<p>
+ How can I do this for <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span><span class="special">()</span></code>?
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.support_concurrency"></a><a class="link" href="todo.html#contract__.todo.support_concurrency" title="Support concurrency">Support concurrency</a>
+</h3></div></div></div>
+<p>
+ Understand what needs to be done to support concurrency.
+ </p>
+<p>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a> discusses issues
+ associated with Contract Programming and concurrency when, for example, a
+ precondition is first checked true but then the sate of the object is changed
+ asynchronously after the precondition check and before body execution so
+ at the time the body executes the checked precondition is no longer true.
+ Eiffel addresses this issue using the SCOOP concurrency model and implementing
+ waiting contract conditions.
+ </p>
+<p>
+ In general, it seems inappropriate for this library to force <span class="emphasis"><em>one</em></span>
+ concurrency model for Contract Programming in C++ (SCOOP, or any other).
+ Synchronization, including the one of contracts, might be best left up to
+ programmers as usual in C++. However, currently it is not possible to lock
+ a mutex at function entry and release it at function exit when using the
+ contract macros. This is because programmers can only program the body so
+ they can lock at body scope but not at the scope of the contracted function.
+ </p>
+<p>
+ More in general, the library could provide a mechanism to:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Acquire resources (including a locks) at function entry.
+ </li>
+<li>
+ Check invariants/preconditions, execute body, check invariants/postconditions
+ via calling contract's <code class="computeroutput"><span class="identifier">call</span><span class="special">()</span></code>.
+ </li>
+<li>
+ Release the acquired resources at function exit.
+ </li>
+</ol></div>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+<span class="bold"><strong>(scoped)</strong></span> <span class="special">(</span> <span class="comment">// In general, no `{` parenthesis here.
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span> <span class="identifier">lock</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">);</span>
+ <span class="special">...</span> <span class="comment">// Eventually more here.
+</span><span class="special">)</span>
+<span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+<span class="special">})</span> <span class="special">)</span>
+
+<span class="comment">// If contracts compilation on, expands to something like this:
+</span><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span> <span class="identifier">lock</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">);</span> <span class="comment">// Scoped resources.
+</span> <span class="identifier">contract_f_</span><span class="special">().</span><span class="identifier">call</span><span class="special">();</span> <span class="comment">// Contract call.
+</span><span class="special">}</span> <span class="comment">// Releases scoped resources via their destructors.
+</span><span class="special">...</span>
+
+<span class="comment">// If contracts compilation off, expands to something like this:
+</span><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span> <span class="identifier">lock</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">);</span> <span class="comment">// Scoped resources.
+</span> <span class="special">...</span> <span class="comment">// Body code
+</span><span class="special">}</span> <span class="comment">// Releases scoped resources via their destructors.
+</span><span class="special">...</span>
+</pre>
+<p>
+ Note:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Even when contract compilation is turned off, the scoped code should be
+ part of the contract macro expansion together with the body code block.
+ </li>
+<li>
+ In general, the scoped code is <span class="emphasis"><em>not</em></span> a code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>
+ (otherwise the acquired resources will be released at scope exit of the
+ code block before calling <code class="computeroutput"><span class="identifier">call</span><span class="special">()</span></code>) but multiple instructions can still
+ be specified.
+ </li>
+<li>
+ Should this scoped code be enforced constant-correct? Maybe not, it should
+ be contract-correct only if the contracted function is a <code class="computeroutput"><span class="keyword">const</span></code> member (same as for the body)... but
+ think more about this.
+ </li>
+</ul></div>
+<p>
+ In addition:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ The library uses a global variable to "globally disable assertion
+ checking within assertion checking". This boolean variable should
+ be synchronized by the library in a concurrent context. However, this will
+ require a global lock... Can I implement "global disabling of assertion
+ checking within assertion checking" without a global state?
+ </li>
+<li>
+ The library uses the object member variable <code class="computeroutput"><span class="identifier">contract_state_</span></code>
+ to disable assertions within nested function calls for a given object.
+ This boolean member variable should be synchronized by the library in a
+ concurrent context. This synchronization is between object member functions,
+ it is not global, so it might be OK...
+ </li>
+<li>
+ If implemented, both global and object synchronizations should be enabled
+ only if a macro symbol <code class="computeroutput"><span class="identifier">CONTRACT_THREADING</span></code>
+ is #defined (#undef by default).
+ </li>
+<li>
+ Can I allow the user to configure how to synchronize global/object state?
+ For example, I could use a configuration macro that by default uses <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">lock</span><span class="special">()</span></code>
+ but it can be #redefined by the user...
+ </li>
+</ol></div>
+<p>
+ Most of these are open issues that need to be analysed in greater detail.
+ </p>
+<p>
+ <span class="bold"><strong>Or</strong></span>, probably a better approach is to add
+ a Concurrency subsection to the Contract Programming annex. This section
+ can be inspired by <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ and explain the issues of concurrency with respect to pre/post conditions
+ and inv checking. The section can then present the ideas of sync every function
+ call so to make sure that contract checking remains consistent with the body
+ execution during the entire function call. Also waiting conditions can be
+ explained here. Then this section can show how to implement this in C++ at
+ a level higher than the contracts (e.g., manually wrapping the contracted
+ function call):
+ </p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">c</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Just a wrap around f() that takes care of synchronization.
+</span> <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span> <span class="identifier">lock</span><span class="special">(</span><span class="identifier">mutex</span><span class="special">);</span>
+ <span class="identifier">f_sync</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
+ <span class="special">}</span>
+
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="comment">// Actual f() with its contract.
+</span> <span class="keyword">void</span> <span class="identifier">f_sync</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">...</span> <span class="special">)</span>
+<span class="special">};</span>
+</pre>
+<p>
+ And maybe also suggest how to implement waiting conditions using a try-catch
+ statement (after contract are changed to throw instead of terminate). Then
+ it should be explained that while Eiffel supports sync and waiting conditions
+ by default using SCOOP, it is not appropriate for this library to enforce
+ one single concurrency schema (SCCOP, or any other) so concurrency is left
+ up to programmers handle outside the library.
+ </p>
+<p>
+ But what about the object state variable and the global assertion checking
+ variable? Are those also sync'ed by the muted above? Maybe the object state
+ is but the global assertion checking variable is probably not sync'ed...
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.can_constructor_member_initialization_list_limitation_be_removed_"></a><a class="link" href="todo.html#contract__.todo.can_constructor_member_initialization_list_limitation_be_removed_" title="Can constructor member initialization list limitation be removed?">Can
+ constructor member initialization list limitation be removed?</a>
+</h3></div></div></div>
+<p>
+ Can the contract macros overcome the constructor member initialization list
+ limitation when separating constructor definition from declaration? See current
+ workaround for this as documented in <code class="computeroutput"><span class="identifier">CONTRACT_CONSTRUCTOR_BODY</span><span class="special">()</span></code>.
+ </p>
+<p>
+ However, this would have to work for all combinations of the followings
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ With and without contracts.
+ </li>
+<li>
+ Definition together and separated from declaration.
+ </li>
+<li>
+ With and without member initialization list.
+ </li>
+</ol></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.should_preconditions_be_checked_before_constructor_member_initialization_list_"></a><a class="link" href="todo.html#contract__.todo.should_preconditions_be_checked_before_constructor_member_initialization_list_" title="Should preconditions be checked before constructor member initialization list?">Should
+ preconditions be checked before constructor member initialization list?</a>
+</h3></div></div></div>
+<p>
+ The library checks constructor preconditions after executing the member initialization
+ list: {Default AND Pre}Body{Post AND Inv} (Default is the member initialization
+ list).
+ </p>
+<p>
+ This is essentially what Eiffel does but constructors (and member initialization
+ lists) are different in C++ than Eiffel. Is this what C++ should do or {Pre
+ AND Default} is a better approach for C++? Why does Eiffel do {Default AND
+ Pre}? Does any of the Contract Programming proposals for C++ mention this
+ issue explicitly? Implementing {Pre AND Default} for this library might present
+ similar challenges to separating constructor definition when member initialization
+ list is specified (so it might not be possible given the lack of delegating
+ constructors in C++...).
+ </p>
+<p>
+ If {Pre AND Default} is a better approach, {Default AND Pre} should be documented
+ as a library limitation. If {Default and Pre} is a better approach, I should
+ document why.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.can_syntax_of_contract_macros_be_unified_with_other_boost_libraries_"></a><a class="link" href="todo.html#contract__.todo.can_syntax_of_contract_macros_be_unified_with_other_boost_libraries_" title="Can syntax of contract macros be unified with other Boost libraries?">Can
+ syntax of contract macros be unified with other Boost libraries?</a>
+</h3></div></div></div>
+<p>
+ Look if the contract macro <code class="computeroutput"><span class="identifier">sequence</span></code>
+ syntax can be unified with the one of other Boost libraries.
+ </p>
+<p>
+ Specifically, is this possible with respect to Boost.ConceptCheck and how
+ concept checking interacts with this Contract Programming library? Same questions
+ respect to Boost.Parameter. Any other Boost library I should study with respect
+ to this issue?
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.consider_allowing_optional_contract_checking_based_on_assertion_importance_and_or_class_name"></a><a class="link" href="todo.html#contract__.todo.consider_allowing_optional_contract_checking_based_on_assertion_importance_and_or_class_name" title="Consider allowing optional contract checking based on assertion importance and/or class name">Consider
+ allowing optional contract checking based on assertion importance and/or class
+ name</a>
+</h3></div></div></div>
+<p>
+ Let's assume I have a template library that is well tested so I want to disable
+ postcondition checking for it. However, this is a template library so it
+ cannot be precompiled separately with postconditions off. I must compile
+ it together with the rest of the code. Therefore, if the rest of the code
+ needs to check postconditions, I must check postconditions for the well tested
+ template library as well... The extra contract checking for the template
+ library introduces both compile-time and run-time overhead.
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ I could address this if the library allowed to disable contract checking
+ (at least at run-time) based on class and function name.
+ </li></ul></div>
+<p>
+ Moreover, there might be contract conditions which are very inefficient to
+ test so I might want to turn off checking <span class="emphasis"><em>only</em></span> for the
+ inefficient conditions. With respect to this issue, <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>
+ recommends to only program preconditions in Eiffel that can be checked efficiently
+ (as preconditions are usually left also in production code) and leave inefficient
+ preconditions documented as code comments.
+ </p>
+<div class="itemizedlist"><ul type="disc"><li>
+ I could address this by disabling contract checking (at least at run-time)
+ based on some assertion <span class="emphasis"><em>importance ordering</em></span> (assertion
+ importance ordering was removed from <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ but is was present in [Crowl2005]).
+ </li></ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.consider_adding_contracts_to_all_stl_classes_and_functions_in__contract__std___"></a><a class="link" href="todo.html#contract__.todo.consider_adding_contracts_to_all_stl_classes_and_functions_in__contract__std___" title="Consider adding contracts to all STL classes and functions in contract::std::">Consider
+ adding contracts to all STL classes and functions in <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span></code></a>
+</h3></div></div></div>
+<p>
+ All <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code>
+ classes and functions could be wrapped by classes and functions in a namespace
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span></code> declaring
+ contracts for all the STL classes and functions. The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span></code>
+ namespace should have the <span class="emphasis"><em>exact</em></span> same structure as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code> (so
+ it is easy to use for C++ programmers familiar with STL).
+ </p>
+<p>
+ For example a <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
+ class can wrap <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code> providing the exact same API but
+ adding contracts to it (similar to the STL Vector <a class="link" href="examples.html" title="Examples">Example</a>
+ but int the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">std</span><span class="special">::</span></code> namespace).
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ The contracts could assert all the STL standard guarantees.
+ </li>
+<li>
+ Postcondition and invariant checking might not add much value given that
+ STL implementations are usually well tested, documented, and work well.
+ </li>
+<li>
+ Precondition checking might instead be valuable as they will check that
+ the STL is not misused by the callers.
+ </li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.should_i_provide__contract_xyz_decl____macros_"></a><a class="link" href="todo.html#contract__.todo.should_i_provide__contract_xyz_decl____macros_" title="Should I provide CONTRACT_XYZ_DECL() macros?">Should
+ I provide <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> macros?</a>
+</h3></div></div></div>
+<p>
+ Two family of macros could be provided:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+<code class="computeroutput"><span class="identifier">CONTRACT_CLASS</span><span class="special">()</span></code>
+ and <code class="computeroutput"><span class="identifier">CONTRACT_FUNCTION</span><span class="special">()</span></code>
+ which follow the relative class and function declarations as coded by the
+ programmers.
+ </li>
+<li>
+<code class="computeroutput"><span class="identifier">CONTRACT_CLASS_DECL</span><span class="special">()</span></code>
+ and <code class="computeroutput"><span class="identifier">CONTRACT_FUNCTION_DECL</span><span class="special">()</span></code> which also automatically program the
+ class and function declarations so programmers do not have to code the
+ declarations manually outside the contracts.
+ </li>
+</ol></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code>
+ macros have the following pro (+) and cons (-) compared to the <code class="computeroutput"><span class="identifier">CONTRACT_XYZ</span><span class="special">()</span></code>
+ macros:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ (+) There is no code duplication when using <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> (because the signature tokens only appear
+ within the macro and not also before the macro).
+ </li>
+<li>
+ (+) When using <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code>, the declarations tokens will always
+ match the ones in the contract because they are not duplicated. When using
+ the <code class="computeroutput"><span class="identifier">CONTRACT_XYZ</span><span class="special">()</span></code>
+ macros instead, a mismatch between the declaration and the contract signature
+ tokens will generate a compiler error in most, but not all, cases.
+ </li>
+<li>
+ (-) The code using <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> is more difficult to read to whom does
+ not know the library syntax because all usual C++ syntax is gone.
+ </li>
+<li>
+ (-) All compiler errors for the class will appear with the same line number
+ because the <code class="computeroutput"><span class="identifier">CONTRACT_CLASS_DECL</span><span class="special">()</span></code> macro will expand on a single line. I
+ think this is a major defect of the <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> macros because it will make C++ compiler
+ error even harder to track than they currently are.
+ </li>
+<li>
+ (~) The <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code> macros will need to accept additional
+ information like inheritance access level, default parameter values, exception
+ specifications, etc. However, the <code class="computeroutput"><span class="identifier">CONTRACT_XYZ</span><span class="special">()</span></code> macros already contain most of the syntactic
+ token of class and function declarations so this is not much of a complication
+ of the macro signature syntax.
+ </li>
+</ol></div>
+<div class="table">
+<a name="id2674416"></a><p class="title"><b>Table 2. Example with and without the macros.</b></p>
+<div class="table-contents"><table class="table" summary="Example with and without the macros.">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ <code class="computeroutput"><span class="identifier">CONTRACT_XYZ</span><span class="special">()</span></code>
+ Macros
+ </p>
+ </th>
+<th>
+ <p>
+ <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code>
+ Macros
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+ <span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span> <span class="special">(</span><span class="keyword">public</span><span class="special">)(</span><span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span>
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">CONTRACT_CLASS_DECL</span><span class="special">(</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span> <span class="special">(</span><span class="keyword">public</span><span class="special">)(</span><span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span>
+
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+
+<span class="special">(</span> <span class="comment">// No class `{};` parenthesis.
+</span>
+ <span class="identifier">CONTRACT_FUNCTION_DECL</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="comment">// Usual C++ class-scope code still works.
+</span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">)</span> <span class="special">)</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<br class="table-break"><p>
+ The syntax of <code class="computeroutput"><span class="identifier">CONTRACT_XYZ_DECL</span><span class="special">()</span></code>, and consequently <code class="computeroutput"><span class="identifier">CONTRACT_XYZ</span><span class="special">()</span></code>, needs to be extended to include <span class="emphasis"><em>all</em></span>
+ class and function signature tokens:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">U</span><span class="special">></span>
+<span class="comment">// class z: public x, protected y
+</span><span class="identifier">CONTRACT_CLASS_DECL</span><span class="special">(</span> <span class="special">(</span><span class="identifier">z</span><span class="special">)</span> <span class="special">(</span><span class="keyword">public</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">public</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span>
+
+ <span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">(</span><span class="identifier">invariant</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+ <span class="special">})</span>
+
+<span class="special">(</span>
+ <span class="keyword">class</span> <span class="identifier">X</span> <span class="special">{};</span> <span class="keyword">class</span> <span class="identifier">Y</span><span class="special">{};</span>
+
+ <span class="comment">// void f(register int i = 0, auto double d = 0.0) throw(X, Y)
+</span> <span class="identifier">CONTRACT_FUNCTION_DECL</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span>
+ <span class="special">(</span><span class="keyword">register</span><span class="special">)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">default</span><span class="special">)(</span><span class="number">0</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">auto</span><span class="special">)(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">(</span><span class="keyword">default</span><span class="special">)(</span><span class="number">0.0</span><span class="special">)</span>
+ <span class="special">)</span> <span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">X</span><span class="special">)</span> <span class="special">(</span><span class="identifier">Y</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="special">...</span>
+ <span class="special">)</span> <span class="special">)</span>
+
+ <span class="special">...</span>
+<span class="special">)</span> <span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Default function parameters indicated using <code class="computeroutput"><span class="keyword">default</span></code>
+ (<code class="computeroutput"><span class="special">=</span></code> symbol cannot be used because
+ it cannot be parsed by the preprocessor). Default is already a keyword
+ (for <code class="computeroutput"><span class="keyword">switch</span><span class="special">()</span></code>)
+ so it works nicely as it already know by programmers (even if in a different
+ context), it will be highlighted by most editors, etc.
+ </li>
+<li>
+ Exceptions specifications are supported using a preprocessor sequence (instead
+ of the usual comma-separated syntax). This is the same syntax already used
+ for both function arguments and template parameters.
+ </li>
+<li>
+ Auto and register qualifier are added to the the function argument list
+ (before the type).
+ </li>
+<li>
+ The <code class="computeroutput"><span class="keyword">friend</span></code> keyword still does
+ not need to be supported because contracts must appear with the class/function
+ declaration. Therefore, friend is used to forward declare the class/function
+ and then contracts are specified where the class/function is actually defined.
+ This approach still maintain the friend functionality with the only limitation
+ that friend functions cannot be defined where they are declared friends
+ (C++ already enforces this constraint but only for classes).
+ </li>
+<li>
+ The <code class="computeroutput"><span class="keyword">union</span></code> keyword is still
+ not supported for <code class="computeroutput"><span class="identifier">CONTRACT_CLASS</span><span class="special">()</span><span class="identifier">_DECL</span></code>
+ because contracts are not supported for unions (only for classes and structs).
+ </li>
+<li>
+ All other C++ keywords are already included in the class/function signatures
+ even if not shown in the example above.
+ </li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.shall_i_remove_the__assert____macros_"></a><a class="link" href="todo.html#contract__.todo.shall_i_remove_the__assert____macros_" title="Shall I remove the ASSERT() macros?">Shall
+ I remove the <code class="computeroutput"><span class="identifier">ASSERT</span><span class="special">()</span></code>
+ macros?</a>
+</h3></div></div></div>
+<p>
+ I am not sure if this would make the syntax better or worst...
+ </p>
+<p>
+ Would removing the <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT</span><span class="special">()</span></code> "simplify" the syntax making
+ it more inline with [Crowl2006]? It might not because the code would look
+ more like [Crowl2006] but it might look less like C++ and be harder to understand...
+ </p>
+<p>
+ Removing the macros will enforce the constraint that contract code is kept
+ simple and to just a list of assertions (with eventual if-guards). However,
+ this constraint makes 100% sense for CP language support but a library might
+ be better off leaving this up to the programmer as a good practice.
+ </p>
+<p>
+ Furthermore, the assertion if-guard imposes the limit that all assertion
+ must start with a word (no symbol). For istance <code class="computeroutput"><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">3</span><span class="special">)</span> <span class="special">&&</span> <span class="special">(</span><span class="identifier">y</span> <span class="special">==</span>
+ <span class="number">4</span><span class="special">)</span></code>
+ is not a valid assertion (it will not pass the preprocessor). However, these
+ assertions could be wrapped by <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">identity</span><span class="special">((</span><span class="identifier">x</span> <span class="special">==</span>
+ <span class="number">3</span><span class="special">)</span> <span class="special">&&</span> <span class="special">(</span><span class="identifier">y</span> <span class="special">==</span> <span class="number">4</span><span class="special">))</span></code> as a workaround... would this acceptable?
+ </p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">identity</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">condition</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">condition</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">}</span> <span class="comment">// namespace
+</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span> <span class="special">=</span> <span class="identifier">allocator</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">></span>
+<span class="identifier">CONTRACT_CLASS_DECL</span><span class="special">(</span> <span class="special">(</span><span class="identifier">vector</span><span class="special">)</span>
+
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)</span> <span class="special">(</span>
+ <span class="special">(</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+
+<span class="special">(</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
+
+ <span class="identifier">CONTRACT_FUNCTION_DECL</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">erase</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">iterator</span><span class="special">)(</span><span class="identifier">first</span><span class="special">)</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)(</span><span class="identifier">last</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">(</span>
+ <span class="comment">// No code block `({ ... })`. Assertions are just a sequence
+</span> <span class="comment">// of booleanable expressions.
+</span> <span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">(</span>
+ <span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">-</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span><span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// Assertion with if-guard.
+</span> <span class="special">)</span>
+ <span class="special">(</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span>
+ <span class="special">)</span> <span class="special">)</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">)</span> <span class="special">)</span>
+</pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.todo.fusing_contracts__concepts__named_parameters__etc_"></a><a class="link" href="todo.html#contract__.todo.fusing_contracts__concepts__named_parameters__etc_" title="Fusing contracts, concepts, named parameters, etc.">Fusing
+ contracts, concepts, named parameters, etc.</a>
+</h3></div></div></div>
+<p>
+ Consider the following C++0x-like example (inspired from ConceptC++ http://www.generic-programming.org/languages/conceptcpp class="emphasis"><em>tutorial</em></span>
+ and C++ Contract Programming proposal [Crowl2006]):
+ </p>
+<pre class="programlisting"><span class="comment">// Example strangely uses pointers instead of iterators just to have preconditions.
+</span><span class="keyword">template</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">CopyConstructible</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="identifier">requires</span> <span class="identifier">Addable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">Assignable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="comment">// Concepts.
+</span><span class="identifier">T</span> <span class="identifier">sum</span><span class="special">(</span><span class="identifier">T</span><span class="special">*</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">T</span><span class="special">*</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">result</span><span class="special">)</span>
+ <span class="identifier">preconditions</span> <span class="special">{</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">}</span> <span class="comment">// Pointer not null.
+</span> <span class="identifier">postconditions</span> <span class="special">(</span><span class="identifier">total</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">total</span> <span class="special">==</span> <span class="identifier">result</span><span class="special">;</span> <span class="special">}</span> <span class="comment">// Returning result.
+</span><span class="special">{</span>
+ <span class="keyword">for</span> <span class="special">(;</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">first</span><span class="special">)</span>
+ <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">result</span> <span class="special">+</span> <span class="special">*</span><span class="identifier">first</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ "What do you think of the following macro that implements this in ISO
+ standard C++ by wrapping the above C++0x-like syntax within a preprocessor
+ sequence?" I have asked this question to Boosters.
+ </p>
+<pre class="programlisting"><span class="identifier">CPP0X_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">CopyConstructible</span><span class="special">)(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">requires</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">Addable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span> <span class="special">(</span><span class="identifier">Assignable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span> <span class="special">)</span>
+<span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">(</span><span class="identifier">sum</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">T</span><span class="special">*)(</span><span class="identifier">first</span><span class="special">)</span> <span class="special">(</span><span class="identifier">T</span><span class="special">*)(</span><span class="identifier">last</span><span class="special">)</span> <span class="special">(</span><span class="identifier">T</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">preconditions</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">first</span><span class="special">)</span> <span class="special">(</span><span class="identifier">last</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postconditions</span><span class="special">)(</span><span class="identifier">total</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">total</span> <span class="special">==</span> <span class="identifier">result</span><span class="special">)</span> <span class="special">)</span>
+<span class="special">({</span>
+ <span class="keyword">for</span> <span class="special">(;</span> <span class="identifier">first</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">first</span><span class="special">)</span>
+ <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">result</span> <span class="special">+</span> <span class="special">*</span><span class="identifier">first</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+</pre>
+<p>
+ The idea is that using the preprocessor I can parse the signature-sequence
+ so I have all the tokens needed to declare/define the C++ function plus its
+ concepts (Boost.Concept), contracts (Boost.Contract), named parameters (Boost.Parameter),
+ etc. Furthermore, the syntax of signature-sequence can be any valid preprocessor
+ sequence that uses words (not symbols) for keywords (e.g., (requires) and
+ (preconditions) are OK but (=) is not). So I can define the signature-sequence
+ syntax to closely match the syntax of C++0x and of other C++ standard proposals
+ (like [Crowl2006]).
+ </p>
+<p>
+ This syntax is not worst than the current Contract++ one. Therefore, it would
+ seem that at least the Contract++ macros should be extended to support concepts
+ (interfacing with Boost.Concept) and possibly also named parameters (interfacing
+ with Boost.Parameter).
+ </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 © 2009 -2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="release_history.html"><img src=".././doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src=".././doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src=".././doc/html/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/tutorial.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,3343 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="getting_started.html" title="Getting Started">
+<link rel="next" href="without_the_macros.html" title="Without the Macros">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="without_the_macros.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.contract_programming_overview">Contract
+ Programming Overview</a></span></dt>
+<dt><span class="section">Checking Contracts</span></dt>
+<dt><span class="section">Contract Macros</span></dt>
+<dt><span class="section">Signature Sequence</span></dt>
+<dt><span class="section">Function Arguments</span></dt>
+<dt><span class="section">Inheritance</span></dt>
+<dt><span class="section">Operators</span></dt>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.overloaded_functions">Overloaded
+ Functions</a></span></dt>
+<dt><span class="section">Function Templates</span></dt>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.deferring_the_body">Deferring the
+ Body</a></span></dt>
+<dt><span class="section">Friends</span></dt>
+<dt><span class="section">Structs and Unions</span></dt>
+<dt><span class="section">Qualifiers</span></dt>
+<dt><span class="section">Blocks and Loops</span></dt>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.exception_specifications">Exception
+ Specifications</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.commas_within_macro_parameters">Commas
+ Within Macro Parameters</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#contract__.tutorial.a_fully_working_example">A Fully
+ Working Example</a></span></dt>
+</dl></div>
+<p>
+ This section gives an overview of Contract Programming and explains how this
+ library can be used to write contracts. At the end of the section there is
+ a fully working example that can be compiled and executed.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.contract_programming_overview"></a><a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview" title="Contract Programming Overview">Contract
+ Programming Overview</a>
+</h3></div></div></div>
+<p>
+ Contract Programming is characterized at least by the following assertion
+ mechanisms (see <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>,
+ <a class="link" href="bibliography.html" title="Bibliography">[Ottosen2004]</a>, or <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>):
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ It is possible to describe <span class="bold"><strong>class invariants</strong></span>.
+ These are logical conditions that programmers expect to be true after
+ the constructor has been executed successfully, before and after the
+ execution of every non-static member function with a contract, and before
+ the destructor is executed (e.g., class invariants can define a valid
+ state for all objects of a class). It is possible to describe <span class="bold"><strong>static class invariants</strong></span> also which are expected
+ to be true before and after the execution of any member function with
+ a contract (including static member functions, constructor entry, and
+ destructor exit).
+ </li>
+<li class="listitem">
+ It is possible to describe function <span class="bold"><strong>preconditions</strong></span>.
+ These are logical conditions that programmers except to be true when
+ the function is called (e.g., to check constraints on input function
+ arguments).
+ </li>
+<li class="listitem">
+ It is possible to describe function <span class="bold"><strong>postconditions</strong></span>.
+ These are logical conditions that programmers expect to be true when
+ the function has ended normally (e.g., to check the result and any side
+ effect that a function might have).
+ </li>
+<li class="listitem">
+ It is possible to formalize the notion of overriding a virtual member
+ function via <span class="bold"><strong>subcontracting</strong></span>. Subcontracting
+ can be justified by substitution principles and it consists of the following
+ rules that the overriding function must obey:
+ <div class="orderedlist"><ol class="orderedlist" type="a">
+<li class="listitem">
+ Preconditions cannot be strengthen.
+ </li>
+<li class="listitem">
+ Postconditions cannot be weaken.
+ </li>
+<li class="listitem">
+ Class invariants cannot be weaken.
+ </li>
+</ol></div>
+ </li>
+<li class="listitem">
+ It is possible to describe <span class="bold"><strong>block invariants</strong></span>.
+ These are logical conditions that programmes except to be true every
+ time the execution reaches the point where the condition is asserted.
+ When used within a loop (i.e., a block of code that can be executed in
+ iteration), block invariants function like <span class="emphasis"><em>loop invariants</em></span>
+ asserting conditions that are excepted to be true for every loop iteration.
+ </li>
+<li class="listitem">
+ It is possible to describe a <span class="bold"><strong>loop variant</strong></span>.
+ This a positive integer expression with a value that is expected to decrease
+ at every subsequent loop iteration.
+ </li>
+</ol></div>
+<p>
+ Based on these definitions of invariants, preconditions, postconditions,
+ and subcontracting it is possible to specify the semantics of the invocation
+ of a function for which a contract has been specified.
+ </p>
+<a name="contract__.tutorial.contract_programming_overview.non_member_function_call_semantics"></a><h6>
+<a name="contract__.tutorial.contract_programming_overview.non_member_function_call_semantics-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.non_member_function_call_semantics">Non-Member
+ Function Call Semantics</a>
+ </h6>
+<p>
+ A non-member function call should execute the following steps:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Check preconditions.
+ </li>
+<li class="listitem">
+ Execute function body.
+ </li>
+<li class="listitem">
+ Check postconditions.
+ </li>
+</ol></div>
+<a name="contract__.tutorial.contract_programming_overview.member_function_call_semantics"></a><h6>
+<a name="contract__.tutorial.contract_programming_overview.member_function_call_semantics-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.member_function_call_semantics">Member
+ Function Call Semantics</a>
+ </h6>
+<p>
+ A member function call should execute the following steps:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Check static class invariants.
+ </li>
+<li class="listitem">
+ Check non-static class invariants <span class="emphasis"><em>AND</em></span>, when subcontracting,
+ check the base class invariants (for non-static member functions only
+ <sup>[<a name="id866548" href="#ftn.id866548" class="footnote">2</a>]</sup>).
+ </li>
+<li class="listitem">
+ Check preconditions <span class="emphasis"><em>OR</em></span>, when subcontracting, check
+ the overridden function preconditions.
+ </li>
+<li class="listitem">
+ Execute function body.
+ </li>
+<li class="listitem">
+ Check static class invariants (even if body throws an exception).
+ </li>
+<li class="listitem">
+ Check non-static class invariants <span class="emphasis"><em>AND</em></span>, when subcontracting,
+ check base class invariants (for non-static member functions only plus
+ checked even if body throws an exception).
+ </li>
+<li class="listitem">
+ Check postconditions <span class="emphasis"><em>AND</em></span>, when subcontracting, check
+ overridden function postconditions (only if body did not throw an exception).
+ </li>
+</ol></div>
+<p>
+ Where <span class="emphasis"><em>AND</em></span> and <span class="emphasis"><em>OR</em></span> are the logical
+ "and" and "or" operators evaluated in short-circuit (i.e.,
+ A <span class="emphasis"><em>AND</em></span> B evaluates B only if A is evaluated to be true,
+ A <span class="emphasis"><em>OR</em></span> B evaluates B only if A is evaluated to be false).
+ </p>
+<p>
+ When a member function overrides more than one virtual function due to multiple
+ inheritance:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Class invariants are checked in <span class="emphasis"><em>AND</em></span> with the invariants
+ of <span class="emphasis"><em>all</em></span> the base classes (following the inheritance
+ order).
+ </li>
+<li class="listitem">
+ Preconditions are checked in <span class="emphasis"><em>OR</em></span> with the preconditions
+ of <span class="emphasis"><em>all</em></span> the overridden functions (following the inheritance
+ order).
+ </li>
+<li class="listitem">
+ Postconditions are checked in <span class="emphasis"><em>AND</em></span> with the postconditions
+ of <span class="emphasis"><em>all</em></span> the overridden functions (following the inheritance
+ order).
+ </li>
+</ul></div>
+<a name="contract__.tutorial.contract_programming_overview.constructor_call_semantics"></a><h6>
+<a name="contract__.tutorial.contract_programming_overview.constructor_call_semantics-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.constructor_call_semantics">Constructor
+ Call Semantics</a>
+ </h6>
+<p>
+ A constructor call should execute the following steps:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Initialize member variables via the constructor member initialization
+ list (if such a list is specified).
+ </li>
+<li class="listitem">
+ Check static class invariants (but not the non-static class invariants).
+ </li>
+<li class="listitem">
+ Check preconditions.
+ </li>
+<li class="listitem">
+ Execute constructor body.
+ </li>
+<li class="listitem">
+ Check static class invariants (even if body throws an exception).
+ </li>
+<li class="listitem">
+ Check class invariants (even if body throws an exception).
+ </li>
+<li class="listitem">
+ Check postconditions (only if body did not throw an exception).
+ </li>
+</ol></div>
+<p>
+ Before constructor body execution, there is no object therefore:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Non-static class invariants do not have to hold true and they are not
+ checked at constructor entry.
+ </li>
+<li class="listitem">
+ Preconditions cannot access the object.
+ </li>
+<li class="listitem">
+ Postconditions cannot access the old object value (as it was before body
+ execution).
+ </li>
+</ul></div>
+<a name="contract__.tutorial.contract_programming_overview.destructor_call_semantics"></a><h6>
+<a name="contract__.tutorial.contract_programming_overview.destructor_call_semantics-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.destructor_call_semantics">Destructor
+ Call Semantics</a>
+ </h6>
+<p>
+ A destructor call should execute the following steps:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Check static class invariants.
+ </li>
+<li class="listitem">
+ Check class invariants.
+ </li>
+<li class="listitem">
+ Execute destructor body.
+ </li>
+<li class="listitem">
+ Check static class invariants (but not the non-static class invariants
+ plus checked even if body throws an exception <sup>[<a name="id866910" href="#ftn.id866910" class="footnote">3</a>]</sup>).
+ </li>
+</ol></div>
+<p>
+ Note that:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Destructors have no arguments so they have no preconditions.
+ </li>
+<li class="listitem">
+ After destructor body execution, there is no object anymore (because
+ it has been destroyed) so non-static class invariants do not have to
+ hold true and they are not checked at destructor exit.
+ </li>
+<li class="listitem">
+ Destructors have no postconditions as there is no function argument and
+ after body execution there is no object.
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.checking_contracts"></a><a class="link" href="tutorial.html#contract__.tutorial.checking_contracts" title="Checking Contracts">Checking Contracts</a>
+</h3></div></div></div>
+<p>
+ After programmers specify contracts, this library provides a mechanism to
+ automatically check if class invariants, preconditions, postconditions, block
+ invariants, and loop variants hold true at run-time or not.
+ </p>
+<p>
+ If a class invariant, precondition, postcondition, block invariant, or loop
+ variant asserted via <code class="computeroutput">CONTRACT_ASSERT<span class="special">()</span></code>, <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT<span class="special">()</span></code>, or <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT<span class="special">()</span></code> is checked to be false, the library invokes
+ the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>class_invariant_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>precondition_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>postcondition_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>block_invariant_failed<span class="special">()</span></code> (for both block invariant and loop variant
+ failures) function respectively. These functions invoke <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code> by default but programmers can redefine
+ them to take a different action using <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>set_class_invariant_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>set_precondition_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>set_postcondition_failed<span class="special">()</span></code>, and <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>set_block_invariant_failed<span class="special">()</span></code>.
+ </p>
+<p>
+ This mechanism is similarly to the one of C++ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">set_terminate</span><span class="special">()</span></code> (see <a class="link" href="throw_on_failure.html" title="Annex: Throw on Failure">Throw
+ on Failure</a> for an example).
+ </p>
+<a name="contract__.tutorial.checking_contracts.constant_correctness"></a><h6>
+<a name="contract__.tutorial.checking_contracts.constant_correctness-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.checking_contracts.constant_correctness">Constant-Correctness</a>
+ </h6>
+<p>
+ Contracts are only supposed to <span class="emphasis"><em>check</em></span> the object state
+ in order to ensure its compliance with the software specifications. Therefore,
+ contract checking should not be allowed to modify the object state and exclusively
+ "read-only" operations (or <span class="emphasis"><em>queries</em></span>) should
+ be used to specify contracts.
+ </p>
+<p>
+ This library enforces <sup>[<a name="id867338" href="#ftn.id867338" class="footnote">4</a>]</sup> this constraint at compile-time using the C++ <code class="computeroutput"><span class="keyword">const</span></code>
+ qualifier. Contracts only have access to the object, function arguments,
+ and return value via constant references thus only constant members can be
+ accessed when checking contracts. Furthermore, pointers are passed as <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">T</span><span class="special">*</span></code> so the pointed object is constants and cannot
+ be changed (note that the pointer value itself is not constant, because it
+ is not passed as <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">T</span><span class="special">*</span> <span class="keyword">const</span></code>, and
+ it could be changed by the contract but such a change will be local to the
+ contract function therefore still ensuring the const-correctness of the contract).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.contract_macros"></a><a class="link" href="tutorial.html#contract__.tutorial.contract_macros" title="Contract Macros">Contract Macros</a>
+</h3></div></div></div>
+<p>
+ The following overview of the contract macros and their usages should be
+ enough to understand the working example at the end of this section, most
+ of the examples in the <a class="link" href="examples.html" title="Examples">Examples</a>
+ annex, and to start writing contracts on your own. Consult the library Reference documentation for more information.
+ <sup>[<a name="id867464" href="#ftn.id867464" class="footnote">5</a>]</sup>.
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_INVARIANT(
+ (static)({ ... }) ({ ... }) )</code></strong></span>
+ </p>
+<p>
+ This macro is used to program class invariants. It should appear within a
+ private section in the class declaration. It takes one parameter which is
+ a Boost.Preprocessor
+ sequence of the following elements:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">({</span> <span class="special">...</span> <span class="special">})</span></code>:
+ The code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span>
+ <span class="special">}</span></code> <sup>[<a name="id867784" href="#ftn.id867784" class="footnote">6</a>]</sup> asserting static class invariants. This is optional and it
+ can be omitted.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">({</span> <span class="special">...</span>
+ <span class="special">})</span></code>: A secondary code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code> asserting non-static class invariants.
+ This is mandatory but an empty code block <code class="computeroutput"><span class="special">({})</span></code>
+ can be specified if there are no class invariants (using <code class="computeroutput">CONTRACT_INVARIANT<span class="special">()</span></code>
+ instead of <code class="computeroutput">CONTRACT_INVARIANT<span class="special">(</span> <span class="special">({})</span> <span class="special">)</span></code> will generate a preprocessor error).
+ </li>
+</ul></div>
+<p>
+ If contract compilation is turned off, this macro expands to nothing (and
+ no contract overhead is added). Otherwise, it expands to code that checks
+ the class invariants (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without
+ the Macros</a> for details).
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_FUNCTION(
+ <span class="emphasis"><em>signature-sequence</em></span> (precondition)({ ... }) (postcondition)(<span class="emphasis"><em>result-name</em></span>)({
+ ... }) (body)({ ... }) )</code></strong></span>
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_CONSTRUCTOR(
+ <span class="emphasis"><em>signature-sequence</em></span> (precondition)({ ... }) (postcondition)({
+ ... }) (body)({ ... }) )</code></strong></span>
+ </p>
+<p>
+ These macros are used to program preconditions and postconditions for functions
+ (members and non) and constructors respectively. They should appear right
+ after the function and constructor declaration, and after the constructor
+ members initialization list when such a list is specified. They both take
+ the following parameters:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <span class="emphasis"><em>signature-sequence</em></span>: A Boost.Preprocessor
+ sequence with the function or constructor signature tokens (see subsections
+ below).
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span> <span class="special">...</span> <span class="special">})</span></code>:
+ An optional code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>
+ asserting the preconditions.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span></code><span class="emphasis"><em>result-name</em></span><code class="computeroutput"><span class="special">)</span> <span class="special">({</span> <span class="special">...</span> <span class="special">})</span></code>:
+ An optional code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>
+ asserting the postconditions. The <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>result-name</em></span><code class="computeroutput"><span class="special">)</span></code> element is only specified for non-void
+ functions (so never for constructors) and it names the variable used
+ to access the return value within postconditions (e.g., <code class="computeroutput"><span class="identifier">result</span></code>).
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)({</span> <span class="special">...</span> <span class="special">})</span></code>: A mandatory code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code> implementing the function or constructor
+ body.
+ </li>
+</ul></div>
+<p>
+ If contract compilation is turned off, these macros simply expand to the
+ body code block (and no contract overhead is added). Otherwise, they expand
+ to code that implements the <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.member_function_call_semantics">Member
+ Function Call Semantics</a> and <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.constructor_call_semantics">Constructor
+ Call Semantics</a> respectively thus checking class invariants, preconditions,
+ and postconditions (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without
+ the Macros</a> for details).
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_DESTRUCTOR(
+ <span class="emphasis"><em>signature-sequence</em></span> (body)({ ... }) )</code></strong></span>
+ </p>
+<p>
+ This macro is used to program destructor contracts. It should appear right
+ after the destructor declaration. It takes the following parameters:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <span class="emphasis"><em>signature-sequence</em></span>: The destructor signature tokens
+ (see below).
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span> <span class="special">...</span> <span class="special">})</span></code>:
+ A mandatory code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>
+ implementing the destructor body.
+ </li>
+</ul></div>
+<p>
+ If contract compilation is turned off, this macro simply expands to the body
+ code block (and no contract overhead is added). Otherwise, it expands to
+ code that implements the <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.destructor_call_semantics">Destructor
+ Call Semantics</a> checking the class invariants (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without
+ the Macros</a> for details).
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_OLDOF(
+ variable_name )</code></strong></span>
+ </p>
+<p>
+ This macro is used to access the old value for the variable with the specified
+ name in postconditions. It takes the following parameter:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+ <code class="computeroutput"><span class="identifier">name</span></code>: The name of the
+ variable. As usual, <code class="computeroutput"><span class="keyword">this</span></code>
+ can be used as the variable name for the object so <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span></code> is used to access the object old value.
+ Otherwise, any of the function argument variable names can be specified.
+ The variable type (class or argument type) must be tagged copyable in
+ the signature sequence for the variable old value to be available (see
+ below). The library generates a compile-time error (containing the text
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code>) if this macro is used on a variable
+ name of a type which was not tagged copyable.
+ </li></ul></div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ This library does not support old values for <span class="emphasis"><em>any</em></span> expression
+ that can be evaluated in postcondition as supported by Eiffel and required
+ <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a> instead. The
+ library supports old values for the object and all the function argument
+ types, and this is a subset of the old values supported by Eiffel and required
+ by <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>. However,
+ the old values supported by the library are usually enough to program the
+ postconditions (e.g., all Eiffel examples from <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>,
+ <a class="link" href="bibliography.html" title="Bibliography">[Mitchell2002]</a>, and all
+ C++ examples from <a class="link" href="bibliography.html" title="Bibliography">[Crowl2006]</a>
+ were successfully programmed using just these old values, see the <a class="link" href="examples.html" title="Examples">Examples</a> section).
+ </p></td></tr>
+</table></div>
+<p>
+ The old value variable are only declared locally within postconditions therefore
+ they cannot be mistakenly accessed outside the related postcondition code
+ block (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without the Macros</a>
+ for details).
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ If pointer types are tagged copyable, then the pointer value, and <span class="emphasis"><em>not</em></span>
+ the pointed value, is copied. Therefore the old pointer value will be available
+ in postconditions via <code class="computeroutput">CONTRACT_OLDOF<span class="special">()</span></code> and <span class="emphasis"><em>not</em></span> the old
+ pointed value. In other words, as usual, shallow copies are performed for
+ pointers (unless the pointed type defines a different copy operation).
+ Be careful as this might not be what you intended when using <code class="computeroutput">CONTRACT_OLDOF<span class="special">()</span></code>
+ on a pointer <sup>[<a name="id868670" href="#ftn.id868670" class="footnote">7</a>]</sup>.
+ </p>
+<p>
+ The notable exception is the object <code class="computeroutput"><span class="keyword">this</span></code>
+ which is passed to the contract functions by pointer but its old value
+ is automatically deep copied by the library.
+ </p>
+</td></tr>
+</table></div>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_ASSERT(
+ boolean_condition )</code></strong></span>
+ </p>
+<p>
+ This macro is used to assert conditions within the class invariant, precondition,
+ and postcondition code blocks (see also CONTRACT_ASSERT_MSG()).
+ It takes the following parameter:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+ <code class="computeroutput"><span class="identifier">boolean_condition</span></code>: The
+ boolean condition being asserted.
+ </li></ul></div>
+<p>
+ If contract compilation is turned off, this macro expands to nothing (and
+ no contract overhead is added). Otherwise, this macro expands to code that
+ triggers the invocation of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>class_invariant_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>precondition_failed<span class="special">()</span></code>, or <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>postcondition_failed<span class="special">()</span></code> in case the asserted boolean condition
+ is evaluated to be false at run-time from within invariants, preconditions,
+ or postconditions respectively (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without
+ the Macros</a> for details).
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_ASSERT_BLOCK_INVARIANT(
+ boolean_condition )</code></strong></span>
+ </p>
+<p>
+ This macro is used to assert invariant within a generic code block (see also
+ CONTRACT_ASSERT_BLOCK_INVARIANT_MSG()).
+ This macro can also be used within loops to assert loop invariants. It takes
+ the following parameter:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+ <code class="computeroutput"><span class="identifier">boolean_condition</span></code>: The
+ boolean condition being asserted.
+ </li></ul></div>
+<p>
+ If contract compilation is turned off, this macro expands to nothing (and
+ no contract overhead is added). Otherwise, this macro expands to code that
+ triggers the invocation of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>block_invariant_failed<span class="special">()</span></code> in case the asserted boolean condition
+ is evaluated to be false at run-time (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without
+ the Macros</a> for details).
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ This macro is similar to the C <code class="computeroutput"><span class="identifier">assert</span><span class="special">()</span></code> macro as it can be used at any point
+ within a block of code. However, in case the asserted condition either
+ throws an exception or it is evaluated to be <code class="computeroutput"><span class="keyword">false</span></code>,
+ this macro invokes <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>block_invariant_failed<span class="special">()</span></code> instead of calling <code class="computeroutput"><span class="identifier">abort</span><span class="special">()</span></code>.
+ </p></td></tr>
+</table></div>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_ASSERT_LOOP_VARIANT(
+ integer_expression )</code></strong></span>
+ </p>
+<p>
+ <span class="bold"><strong><code class="literal">CONTRACT_INIT_LOOP_VARIANT</code></strong></span>
+ </p>
+<p>
+ This macro is used to assert loop variants (see also CONTRACT_ASSERT_LOOP_VARIANT_MSG()).
+ It must be used <span class="emphasis"><em>after</em></span> <code class="computeroutput">CONTRACT_INIT_LOOP_VARIANT</code>
+ has been called once within the same code block scope (see below).
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+ <code class="computeroutput"><span class="identifier">integer_expression</span></code>: An
+ integer expression which is evaluated at each loop iteration as the loop
+ variant. It must be always positive (not negative and not zero) and it
+ must strictly decrease at each subsequent loop iteration (of <code class="computeroutput"><span class="number">1</span></code> or more).
+ </li></ul></div>
+<p>
+ If contract compilation is turned off, this macro expands to nothing (and
+ no contract overhead is added). Otherwise, this macro expands to code that
+ triggers the invocation of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>block_invariant_failed<span class="special">()</span></code> at run-time in case the specified variant
+ expression is either not positive or it does not decrease from one loop iteration
+ to the next (see <a class="link" href="without_the_macros.html" title="Without the Macros">Without the
+ Macros</a> for details).
+ </p>
+<a name="contract__.tutorial.contract_macros.step_by_step_example"></a><h6>
+<a name="contract__.tutorial.contract_macros.step_by_step_example-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_macros.step_by_step_example">Step-by-Step
+ Example</a>
+ </h6>
+<p>
+ Let's assume we want to write a <code class="computeroutput"><span class="identifier">myvector</span></code>
+ class template that wraps the C++ STL vector template <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
+ adding contracts to it. Here we show, step-by-step, how to program a contract
+ for the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function.
+ </p>
+<p>
+ <span class="bold"><strong>Step 1)</strong></span> First, we implement <code class="computeroutput"><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">()</span></code>
+ to call <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">()</span></code>
+ and we can sketch the contract using comments.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="comment">// Invariant: (size() == 0) == empty()</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Precondition: size() < max_size()</span>
+ <span class="comment">// Postcondition: size() == (oldof size() + 1)</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="special">}</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Where "<code class="computeroutput"><span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span></code>" indicates the value <code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code>
+ has before the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> function is executed.
+ </p>
+<p>
+ To keep this example simple, we intentionally did not write the full contract
+ but we only wrote one invariant, one precondition, and one postcondition
+ (see the STL Vector <a class="link" href="examples.html" title="Examples">Example</a> for
+ the complete <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ contract). These contract conditions specify the followings:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The class invariant asserts that the vector is empty if and only if its
+ size is zero.
+ </li>
+<li class="listitem">
+ The precondition asserts that the vector size must be smaller than the
+ maximum size when <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> is called (so there is available space
+ to add one extra vector element).
+ </li>
+<li class="listitem">
+ The postcondition asserts that the vector size must increase by 1 after
+ <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ has been executed (to reflect the newly added vector element).
+ </li>
+</ol></div>
+<p>
+ <span class="bold"><strong>Step 2)</strong></span> The library provides the <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code>
+ macro to write member function contracts. This macro must be used <span class="emphasis"><em>right
+ after</em></span> the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> function declaration. The <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function definition <code class="computeroutput"><span class="special">{</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">();</span> <span class="special">}</span></code> is moved
+ within the macro becoming the last element of the Boost.Preprocessor
+ sequence passed as the macro parameter:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="comment">// Invariant: (size() == 0) == empty()</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Precondition: size() < max_size()</span>
+ <span class="comment">// Postcondition: size() == (old size()) + 1</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="bold"><strong>CONTRACT_FUNCTION</strong></span><span class="special">(</span> <span class="emphasis"><em>signature-sequence</em></span>
+ <span class="emphasis"><em>precondition-sequence</em></span>
+ <span class="emphasis"><em>postcondition-sequence</em></span>
+ <span class="bold"><strong>(body) ({
+ vector_.push_back(element);
+ })</strong></span> ) <span class="comment">// No need for ";" after the macro closing parenthesis ")".</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ There is no need for "<code class="computeroutput"><span class="special">;</span></code>"
+ after the macro closing parenthesis "<code class="computeroutput"><span class="special">)</span></code>".
+ </p>
+<p>
+ <span class="bold"><strong>Step 3)</strong></span> We now program the postconditions
+ using <code class="computeroutput">CONTRACT_ASSERT<span class="special">()</span></code> inside a code block <code class="computeroutput"><span class="special">{</span>
+ <span class="special">...</span> <span class="special">}</span></code>
+ specifying the <span class="emphasis"><em>postcondition-sequence</em></span> elements:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="comment">// Invariant: (size() == 0) == empty()</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Precondition: size() < max_size()</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="emphasis"><em>signature-sequence</em></span>
+ <span class="emphasis"><em>precondition-sequence</em></span>
+ <span class="bold"><strong>(postcondition) ({
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() + 1) );
+ })</strong></span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note how <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span></code> is used
+ to access the old object value as it was before body execution.
+ </p>
+<p>
+ <span class="bold"><strong>Step 4)</strong></span> Similarly, we program the preconditions
+ in a code block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span>
+ <span class="special">}</span></code> specifying the <span class="emphasis"><em>precondition-sequence</em></span>
+ elements:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="comment">// Invariant: (size() == 0) == empty()</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="emphasis"><em>signature-sequence</em></span>
+ <span class="bold"><strong>(precondition) ({
+ CONTRACT_ASSERT( size() < max_size() );
+ })</strong></span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ <span class="bold"><strong>Step 5)</strong></span> The <span class="emphasis"><em>signature-sequence</em></span>
+ elements are discussed separately (see below) and for now we will leave them
+ unresolved.
+ </p>
+<p>
+ <span class="bold"><strong>Step 6)</strong></span> Similarly to what we did with for
+ preconditions and postconditions, we program the class invariants in a code
+ block <code class="computeroutput"><span class="special">{</span> <span class="special">...</span>
+ <span class="special">}</span></code> specifying sequence elements passed
+ to the <code class="computeroutput">CONTRACT_INVARIANT<span class="special">()</span></code> macro:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+
+ <span class="bold"><strong>CONTRACT_INVARIANT( ({
+ CONTRACT_ASSERT( (size() == 0) == empty() );
+ }) )</strong></span> <span class="comment">// Again, no need for ";" after the macro closing parenthesis ")".</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="emphasis"><em>signature-sequence</em></span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Again, there is no need for "<code class="computeroutput"><span class="special">;</span></code>"
+ after the macro closing parenthesis "<code class="computeroutput"><span class="special">)</span></code>".
+ </p>
+<p>
+ <span class="bold"><strong>Step 7)</strong></span> The same step-by-step process can
+ be applied to understand the usage of <code class="computeroutput">CONTRACT_CONSTRUCTOR<span class="special">()</span></code> and <code class="computeroutput">CONTRACT_DESTRUCTOR<span class="special">()</span></code> (see the example at the very end of this
+ section).
+ </p>
+<a name="contract__.tutorial.contract_macros.contract_code_blocks"></a><h6>
+<a name="contract__.tutorial.contract_macros.contract_code_blocks-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.contract_macros.contract_code_blocks">Contract
+ Code Blocks</a>
+ </h6>
+<p>
+ This library allows for arbitrary constant-correct code within the class
+ invariant, precondition, and postcondition code blocks <code class="computeroutput"><span class="special">({</span>
+ <span class="special">...</span> <span class="special">})</span></code>.
+ </p>
+<p>
+ In other words, the class invariant, precondition, and postcondition code
+ blocks can contain any legal C++ code and they can access any constant class
+ member (private, protected, or public). However, writing complex code in
+ the contracts will increase the probability of introducing bugs in the contracts
+ themselves so it is better to limit the contract code to a simple list of
+ assertions with occasional if-statements to guard them. Furthermore, if non-public
+ members are used in preconditions then the callers will not be able to fully
+ check the preconditions to make sure the contract is satisfied before calling
+ the function so it is best to only use public members at least in preconditions
+ <sup>[<a name="id871438" href="#ftn.id871438" class="footnote">8</a>]</sup>.
+ </p>
+<p>
+ In addition, this library checks class invariants (as well as preconditions
+ and postconditions) only for functions that have a contract. For example,
+ if a private member function is allowed to <span class="emphasis"><em>temporarily</em></span>
+ brake the class invariants, you can omit the contract for that one private
+ function so no invariants (as well as no preconditions and no postconditions)
+ will be checked when that function is called. However, it should never be
+ the case that public member functions can brake class invariants. It is recommended
+ to write contracts for all functions (public and non) with the rare exceptions
+ of a private member function that cannot be programmed without allowing for
+ it to temporarily brake the class invariants.
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Recommended Practices</strong></span>
+ </p>
+<p>
+ 1. Limit the contract code to a list of assertions with occasional if-statements
+ to guard them.
+ </p>
+<p>
+ 2. Only access public class members when asserting preconditions.
+ </p>
+<p>
+ 3. Write contracts at least for all public member functions (even if they
+ have no preconditions and no postconditions) so they check the class invariants.
+ </p>
+</td></tr>
+</table></div>
+<p>
+ These practices are followed by all the examples of this documentation.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.signature_sequence"></a><a class="link" href="tutorial.html#contract__.tutorial.signature_sequence" title="Signature Sequence">Signature Sequence</a>
+</h3></div></div></div>
+<p>
+ The very first elements of the Boost.Preprocessor
+ sequence passed to the macros <code class="computeroutput">CONTRACT_CONSTRUCTOR<span class="special">()</span></code>, <code class="computeroutput">CONTRACT_DESTRUCTOR<span class="special">()</span></code>, and <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code> are the elements of the <span class="emphasis"><em>signature-sequence</em></span>
+ <sup>[<a name="id871584" href="#ftn.id871584" class="footnote">9</a>]</sup>. The <span class="emphasis"><em>signature-sequence</em></span> repeats the syntactic
+ elements of the function declaration. <sup>[<a name="id871800" href="#ftn.id871800" class="footnote">10</a>]</sup>
+ </p>
+<p>
+ The syntax of <span class="emphasis"><em>signature-sequence</em></span> is somewhat unusual
+ (even if it is all legal ISO standard C++). However, there is a convenient
+ rule for remembering this syntax:
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Signature Sequence Mnemonic</strong></span>
+ </p>
+<p>
+ The tokens in the signature sequence appear in the exact same order as
+ they appear in the relative function declaration.
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.tutorial.signature_sequence.an_example"></a><h6>
+<a name="contract__.tutorial.signature_sequence.an_example-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.signature_sequence.an_example">An Example</a>
+ </h6>
+<p>
+ Let's consider the following example (with respect to the <code class="computeroutput"><span class="identifier">myvector</span></code>
+ example above, we have added the base class <code class="computeroutput"><span class="identifier">pushable</span></code>
+ to show how to subcontract):
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="bold"><strong>class myvector:</strong></span> <span class="keyword">public</span> <span class="bold"><strong>pushable<T></strong></span> <span class="special">{</span>
+<span class="bold"><strong>public</strong></span><span class="special">:</span>
+ <span class="bold"><strong>void push_back(const T& element)</strong></span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="emphasis"><em>signature-sequence</em></span> <span class="special">...</span> <span class="special">)</span>
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Applying the mnemonic rule, we read the declaration of <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> from top to bottom and we find the following
+ tokens in the listed order (we have to start all the way up to the top of
+ the <code class="computeroutput"><span class="identifier">myvector</span></code> class declaration):
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">class</code></strong></span> keyword
+ for <code class="computeroutput"><span class="identifier">myvector</span></code> (this indicates
+ that <code class="computeroutput"><span class="identifier">push_back</span></code> is a member
+ function).
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">myvector</code></strong></span> class
+ type (this indicates that <code class="computeroutput"><span class="identifier">push_back</span></code>
+ is a member function of <code class="computeroutput"><span class="identifier">myvector</span></code>).
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">pushable<T></code></strong></span>
+ base class which is repeated in <span class="emphasis"><em>signature-sequence</em></span>
+ as <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span><span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span></code> but only when the function is subcontracting
+ from the specified base class (because "<code class="computeroutput"><span class="special">:</span></code>"
+ is not a valid preprocessor token <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)</span></code>
+ is used instead; also the inheritance access level, the <code class="computeroutput"><span class="keyword">public</span></code> keyword in this case, is not relevant
+ and it is not repeated in <span class="emphasis"><em>signature-sequence</em></span>).
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">public</code></strong></span> access
+ level of the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> member function.
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">void</code></strong></span> return type.
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">push_back</code></strong></span> function
+ name.
+ </li>
+<li class="listitem">
+ The parenthesis "<span class="bold"><strong><code class="literal">(</code></strong></span>"
+ to open the function argument list.
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">const T&</code></strong></span>
+ function argument type.
+ </li>
+<li class="listitem">
+ The <span class="bold"><strong><code class="literal">element</code></strong></span> function
+ argument name.
+ </li>
+<li class="listitem">
+ The parenthesis "<span class="bold"><strong><code class="literal">)</code></strong></span>"
+ to close the function argument list.
+ </li>
+</ol></div>
+<p>
+ Wrapping all these tokens within parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ and listing them in the exact order as they appear in the function declaration,
+ we obtain the <span class="emphasis"><em>signature-sequence</em></span> elements for this example.
+ The parenthesis <code class="computeroutput"><span class="special">()</span></code> around the
+ tokens are mandatory because they are the ones actually creating the Boost.Preprocessor
+ sequence. New lines and spaces do not matter within preprocessor sequences.
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)(</span><span class="identifier">myvector</span><span class="special">)</span> <span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span><span class="identifier">vector_interface</span><span class="special"><</span><span class="identifier">T</span><span class="special">>)</span>
+<span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">myvector</span></code> class type is
+ preceded by <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span></code> because, for this example, we wanted to
+ access the old object value <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)</span></code>
+ (as the object was before the function body execution) in the postconditions.
+ Also any function argument type can be tagged copyable if the old value of
+ the related argument is needed in the postconditions. In this example, <code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span></code> could have been tagged copyable and specified
+ in <span class="emphasis"><em>signature-sequence</em></span> as <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span></code> if the old value of the argument <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">element</span><span class="special">)</span></code>
+ (as the argument was before the body execution) was needed in the postconditions.
+ </p>
+<p>
+ Completing the example presented in the previous section, with the addition
+ of subcontracting <code class="computeroutput"><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">()</span></code> from <code class="computeroutput"><span class="identifier">pushable</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">()</span></code>, we have:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+ <span class="identifier">CONTRACT_INVARIANT</span><span class="special">(</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="bold"><strong>(class) (copyable)(myvector)
+ (inherit)(pushable<T>)
+ (public) (void) (push_back)( (const T&)(element) )</strong></span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ This is a fully working example assuming that:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">pushable</span><span class="special">::</span><span class="identifier">push_back</span><span class="special">()</span></code>
+ also has a contract specified using this library since it is used for
+ subcontracting (this library allows to specify contracts also for pure
+ virtual functions, see below).
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">myvector</span></code> has an accessible
+ constant-correct <sup>[<a name="id873455" href="#ftn.id873455" class="footnote">11</a>]</sup> copy constructor since it was tagged <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span></code>
+ (see <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copy</code>):
+ </li>
+</ol></div>
+<pre class="programlisting"><span class="comment">// Must be accessible and construct from a const& parameter.</span>
+<span class="identifier">myvector</span><span class="special">::</span><span class="identifier">myvector</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">source</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
+</pre>
+<p>
+ If either one of these conditions is not true, this library will generate
+ a compile-time errors when attempting to compile the code above.
+ </p>
+<a name="contract__.tutorial.signature_sequence.full_syntax"></a><h6>
+<a name="contract__.tutorial.signature_sequence.full_syntax-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.signature_sequence.full_syntax">Full Syntax</a>
+ </h6>
+<p>
+ Generalizing this example to include <span class="emphasis"><em>all</em></span> possible syntactic
+ elements that can be found in a C++ function declaration, we obtain the full
+ syntax for <span class="emphasis"><em>signature-sequence</em></span>.
+ </p>
+<p>
+ <span class="bold"><strong><span class="emphasis"><em>signature-sequence</em></span> syntax for
+ <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code>:</strong></span>
+ </p>
+<p>
+ For member functions:
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">struct</span><span class="special">)</span><span class="emphasis"><em>}</em></span> /[/<span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>/]/<span class="special">(</span><span class="emphasis"><em>class-type</em></span><span class="special">)</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span><span class="emphasis"><em>base-class-type</em></span><span class="special">)</span><span class="emphasis"><em>}*</em></span>
+<span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">protected</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">private</span><span class="special">)</span><span class="emphasis"><em>}</em></span>
+/[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="emphasis"><em>function-template-parameter-type</em></span><span class="special">)(</span><span class="emphasis"><em>function-template-parameter-name</em></span><span class="special">)</span><span class="emphasis"><em>}+</em></span> <span class="special">)</span>/]/
+/[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">static</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span>/]/
+<span class="special">(</span><span class="emphasis"><em>result-type</em></span><span class="special">)</span> <span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> /{[/<span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>/]/<span class="special">(</span><span class="emphasis"><em>argument-type</em></span><span class="special">)(</span><span class="emphasis"><em>argument-name</em></span><span class="special">)</span><span class="emphasis"><em>}+}</em></span> <span class="special">)</span>
+/[/<span class="special">(</span><span class="keyword">const</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span>/]/
+</pre>
+<p>
+ For non-member functions:
+ </p>
+<pre class="programlisting">/[[/<span class="special">(</span><span class="keyword">export</span><span class="special">)</span>/]/ <span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="emphasis"><em>function-template-parameter-type</em></span><span class="special">)(</span><span class="emphasis"><em>function-template-parameter-name</em></span><span class="special">)</span><span class="emphasis"><em>}+</em></span> <span class="special">)</span>/]/
+/[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">extern</span> /[extern-string]/<span class="special">)</span>/]/
+<span class="special">(</span><span class="emphasis"><em>result-type</em></span><span class="special">)</span> <span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> /{[/<span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>/]/<span class="special">(</span><span class="emphasis"><em>argument-type</em></span><span class="special">)(</span><span class="emphasis"><em>argument-name</em></span><span class="special">)</span><span class="emphasis"><em>}+}</em></span> <span class="special">)</span>
+</pre>
+<p>
+ Note that <code class="computeroutput"><span class="special">(</span><span class="keyword">static</span><span class="special">)</span></code> is used as usual for static member function
+ but it cannot be specified for non-member functions because its use for non-members
+ was deprecated from C to C++.
+ </p>
+<p>
+ We have used the following conventions in writing the <span class="emphasis"><em>signature-sequence</em></span>
+ syntax:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ // indicates an optional item.
+ </li>
+<li class="listitem">
+ <code class="literal">item</code><span class="emphasis"><em>*</em></span> indicates an item repeated
+ zero of more times.
+ </li>
+<li class="listitem">
+ <code class="literal">item</code><span class="emphasis"><em>+</em></span> indicates an item repeated
+ one of more times.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>{</em></span><code class="literal">item1 </code> <span class="emphasis"><em>operation
+ </em></span> <code class="literal">item2 </code> <span class="emphasis"><em>operation ...}</em></span>
+ indicates the item resulting after evaluating the expression within the
+ curly parenthesis.
+ </li>
+<li class="listitem">
+ <code class="literal">item1</code> <span class="emphasis"><em>| </em></span> <code class="literal">item2</code>
+ indicates that one of the two items, but not both, must be specified.
+ </li>
+</ul></div>
+<p>
+ For example:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ // indicates that <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span></code> is optional (it will only be specified
+ for variables with old values in postconditions).
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>{</em></span><code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span></code><span class="emphasis"><em>base-class-type</em></span><code class="computeroutput"><span class="special">)</span></code><span class="emphasis"><em>}*</em></span> indicates that
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span></code><span class="emphasis"><em>base-class-type</em></span><code class="computeroutput"><span class="special">)</span></code> can be repeated zero or more times (it
+ can be omitted, it will only be specified when subcontracting, and when
+ specified it can be repeated multiple times to support subcontracting
+ from multiple base classes in case of multiple inheritance).
+ </li>
+<li class="listitem">
+ /{/<code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>argument-type</em></span><code class="computeroutput"><span class="special">)(</span></code>argument-name<code class="computeroutput"><span class="special">)</span></code><span class="emphasis"><em>}+</em></span>
+ indicates that the function arguments (when specified instead of <code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>) must be repeated one or more times
+ (together with their optional <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span></code>
+ tag).
+ </li>
+<li class="listitem">
+ // indicates that the access level is optional but when specified it
+ must be either <code class="computeroutput"><span class="special">(</span><span class="keyword">public</span><span class="special">)</span></code>, <code class="computeroutput"><span class="special">(</span><span class="keyword">protected</span><span class="special">)</span></code>,
+ or <code class="computeroutput"><span class="special">(</span><span class="keyword">private</span><span class="special">)</span></code>.
+ </li>
+</ul></div>
+<p>
+ The syntaxes of <span class="emphasis"><em>signature-sequence</em></span> used by <code class="computeroutput">CONTRACT_CONSTRUCTOR<span class="special">()</span></code>
+ and <code class="computeroutput">CONTRACT_DESTRUCTOR<span class="special">()</span></code> are somewhat different because C++ uses
+ different syntactic elements for constructor and destructor declarations
+ than for member functions (constructors cannot be virtual, destructors cannot
+ have function arguments, etc). However, the syntax for these <span class="emphasis"><em>signature-sequences</em></span>
+ are still obtained applying the basic rule of listing the constructor and
+ destructor signature tokens in the exact same order as they appear in the
+ constructor and destructor declarations.
+ </p>
+<p>
+ <span class="bold"><strong><span class="emphasis"><em>signature-sequence</em></span> syntax for
+ <code class="computeroutput">CONTRACT_CONSTRUCTOR<span class="special">()</span></code>:</strong></span>
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">struct</span><span class="special">)</span><span class="emphasis"><em>}</em></span> <span class="special">(</span><span class="emphasis"><em>class-type</em></span><span class="special">)</span>
+<span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">protected</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">private</span><span class="special">)</span><span class="emphasis"><em>}</em></span>
+/[/<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="emphasis"><em>function-template-parameter-type</em></span><span class="special">)(</span><span class="emphasis"><em>function-template-parameter-name</em></span><span class="special">)</span><span class="emphasis"><em>}+</em></span> <span class="special">)</span>/]/
+/[/<span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/
+<span class="special">(</span><span class="emphasis"><em>class-name</em></span><span class="special">)(</span> <span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> /{[/<span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>/]/<span class="special">(</span><span class="emphasis"><em>argument-type</em></span><span class="special">)(</span><span class="emphasis"><em>argument-name</em></span><span class="special">)</span><span class="emphasis"><em>}+}</em></span> <span class="special">)</span>
+</pre>
+<p>
+ As usual, <span class="emphasis"><em>class-name</em></span> is used as the <span class="emphasis"><em>function-name</em></span>
+ for constructors and there is no <span class="emphasis"><em>result-type</em></span>. Furthermore,
+ the library does not currently error if <code class="computeroutput"><span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span></code>
+ is not specified in <span class="emphasis"><em>signature-sequence</em></span> even if the contracted
+ constructor is <code class="computeroutput"><span class="keyword">explicit</span></code>. <sup>[<a name="id875102" href="#ftn.id875102" class="footnote">12</a>]</sup>
+ </p>
+<p>
+ <span class="bold"><strong><span class="emphasis"><em>signature-sequence</em></span> syntax for
+ <code class="computeroutput">CONTRACT_DESTRUCTOR<span class="special">()</span></code>:</strong></span>
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">struct</span><span class="special">)</span><span class="emphasis"><em>}</em></span> <span class="special">(</span><span class="emphasis"><em>class-type</em></span><span class="special">)</span>
+<span class="emphasis"><em>{</em></span><span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">protected</span><span class="special">)</span> <span class="emphasis"><em>|</em></span> <span class="special">(</span><span class="keyword">private</span><span class="special">)</span><span class="emphasis"><em>}</em></span>
+/[/<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span>/]/ /[/<span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span>/]/
+<span class="special">(</span><span class="emphasis"><em>class-name</em></span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+</pre>
+<p>
+ Note that <span class="emphasis"><em>class-name</em></span> and <span class="emphasis"><em>not</em></span> <code class="computeroutput"><span class="special">~</span></code><span class="emphasis"><em>class-name</em></span> is used as
+ <span class="emphasis"><em>function-name</em></span> for destructors (<code class="computeroutput"><span class="string">"~"</span></code>
+ cannot be used because it is not a valid preprocessor token). Furthermore,
+ as usual destructors have no <span class="emphasis"><em>result-type</em></span> and no function
+ arguments (the argument list is always specified <code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>).
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Not in Signature Sequence</strong></span>
+ </p>
+<p>
+ Eventual function argument default values and the keywords <code class="computeroutput"><span class="keyword">friend</span></code>, <code class="computeroutput"><span class="keyword">throw</span></code>
+ (for exception specifications), <code class="computeroutput"><span class="keyword">auto</span></code>,
+ <code class="computeroutput"><span class="keyword">register</span></code>, <code class="computeroutput"><span class="keyword">union</span></code>
+ are <span class="bold"><strong>not</strong></span> repeated in the <span class="emphasis"><em>signature-sequence</em></span>
+ (the library will generate compile-time errors otherwise). However, these
+ features are still supported for the contracted function as discussed in
+ the rest of this section (with the exception of <code class="computeroutput"><span class="keyword">union</span></code>
+ for which contracts are not supported by this library).
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.tutorial.signature_sequence.syntax_errors"></a><h6>
+<a name="contract__.tutorial.signature_sequence.syntax_errors-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.signature_sequence.syntax_errors">Syntax
+ Errors</a>
+ </h6>
+<p>
+ The usual C++ syntax constraints apply. For example, <code class="computeroutput"><span class="special">(</span><span class="keyword">static</span><span class="special">)</span></code> cannot
+ be specified together with <code class="computeroutput"><span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span></code>.
+ </p>
+<p>
+ Furthermore, the tokens must be specified in the order listed above even
+ if the C++ syntax allows for different ordering. For example, <code class="computeroutput"><span class="special">(</span><span class="keyword">const</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span></code> must be specified in this order, and not
+ as <code class="computeroutput"><span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span></code>, even if C++ accepts both of orderings.
+ Fixing one specific ordering does not alter the semantics of the code. <sup>[<a name="id875716" href="#ftn.id875716" class="footnote">13</a>]</sup>
+ </p>
+<p>
+ The library will generate compile-time errors if <span class="emphasis"><em>signature-sequence</em></span>
+ contains tokens combinations which are not valid respect to the C++ syntax.
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Cryptic Preprocessing Errors</strong></span>
+ </p>
+<p>
+ There is only a limited amount of compile-time error checking which this
+ library can do on <span class="emphasis"><em>signature-sequence</em></span>. In some cases,
+ and depending on the compiler used, an error in programming the <span class="emphasis"><em>signature-sequence</em></span>
+ syntax will result in cryptic compiler errors.
+ </p>
+<p>
+ These compiler errors might involve library internal templates and macros
+ as well as Boost.Preprocessor
+ internal macros (<code class="computeroutput"><span class="identifier">BOOST_PP_</span><span class="special">...</span></code>). Furthermore, the error line number
+ will only refer to the first line of code at which the contract macro appears
+ (because new lines within macro parameters are removed by the preprocessor).
+ </p>
+<p>
+ The best way to resolve these errors is usually to inspect the <span class="emphasis"><em>signature-sequence</em></span>
+ by eye instead of trying to make sense of the compiler error messages.
+ Also, try to compile with contracts turned off to make sure that the errors
+ are actually in the contract code. Rarely, it might be useful to look at
+ the code generated by the contract macro expansion after preprocessing
+ using your compiler related options ("-E -P" on GCC, "/EP"
+ on Microsoft Visual C++, etc).
+ </p>
+<p>
+ While the C++ preprocessor imposes limits on the amount of error checking
+ that can be performed on <span class="emphasis"><em>signature-sequence</em></span>, the current
+ library implementation does <span class="emphasis"><em>not</em></span> implement the best
+ possible preprocessor error detection and reporting strategy. This is an
+ area of improvement for the library that is currently being worked on.
+ </p>
+<p>
+ <span class="underline">Please report on the library <a href="http://sourceforge.net/projects/dbcpp/forums/forum/920163" target="_top">help
+ website</a> the criptic preprocessing errors you experience in order
+ to facilitate this process.</span>
+ </p>
+</td></tr>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.function_arguments"></a><a class="link" href="tutorial.html#contract__.tutorial.function_arguments" title="Function Arguments">Function Arguments</a>
+</h3></div></div></div>
+<p>
+ Note that within <span class="emphasis"><em>signature-sequence</em></span>, multiple function
+ arguments (as well as function template parameters) are <span class="emphasis"><em>not</em></span>
+ separated by commas (you can use a space or a new line instead):
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="special">(</span><span class="emphasis"><em>argument-type1</em></span><span class="special">)(</span><span class="emphasis"><em>argument-name1</em></span><span class="special">)</span>
+ <span class="comment">/* no comma (a space or new line can be used instead) */</span>
+ <span class="special">(</span><span class="emphasis"><em>argument-type2</em></span><span class="special">)(</span><span class="emphasis"><em>arguments-name2</em></span><span class="special">)</span>
+ <span class="comment">/* no comma (a space or new line can be used instead) */</span>
+ <span class="special">(</span><span class="emphasis"><em>argument-type3</em></span><span class="special">)(</span><span class="emphasis"><em>argument-name3</em></span><span class="special">)</span> <span class="emphasis"><em>...</em></span> <span class="special">)</span>
+</pre>
+<a name="contract__.tutorial.function_arguments.no_argument"></a><h6>
+<a name="contract__.tutorial.function_arguments.no_argument-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.function_arguments.no_argument">No Argument</a>
+ </h6>
+<p>
+ If the function has no arguments, the argument list must be specified <code class="computeroutput"><span class="keyword">void</span></code>:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span>
+</pre>
+<p>
+ Note that <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)(</span> <span class="special">)</span></code> <span class="bold"><strong>cannot</strong></span> be used instead and it will generate a (cryptic)
+ compile-time error.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ An empty function argument list cannot be represented simply by empty parenthesis
+ <code class="computeroutput"><span class="special">()</span></code> as in <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)()</span></code> because the C++ standard does not allow
+ to specify empty preprocessor sequence elements like <code class="computeroutput"><span class="special">()</span></code>
+ thus <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span></code> must
+ be used instead. Note that the C++ standard allows to use <code class="computeroutput"><span class="keyword">void</span></code> to specify a function with no arguments
+ <span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code> (this
+ is the syntax used in all the examples of this documentations to be consistent
+ with the relative <span class="emphasis"><em>signature-sequence</em></span> syntax requirement).
+ </p>
+<p>
+ The C99 standard instead allows for empty preprocessor sequence elements
+ <code class="computeroutput"><span class="special">()</span></code> (because it allows for
+ empty macro parameters, see <a class="link" href="bibliography.html" title="Bibliography">[Nelson2004]</a>
+ and Boost.Preprocessor
+ for details). C99 also defines deprecated the use of <code class="computeroutput"><span class="keyword">void</span></code>
+ for functions with no arguments -- <span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>
+ is deprecated. Therefore, on C99 compilers <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)()</span></code> should be used in <span class="emphasis"><em>signature-sequence</em></span>
+ for functions with no arguments instead of <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span></code>.
+ </p>
+<p>
+ This library supports both syntaxes <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span></code> and
+ <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)()</span></code> in <span class="emphasis"><em>signature-sequence</em></span>
+ but the later syntax will only compile for C99 (so it is not recommended).
+ </p>
+<p>
+ The same limitation applies to the <code class="computeroutput">CONTRACT_INVARIANT<span class="special">()</span></code> macro when the class has no invariant.
+ Also in this case the library supports both syntaxes <code class="computeroutput">CONTRACT_INVARIANT<span class="special">(</span> <span class="special">({})</span> <span class="special">)</span></code> and <code class="computeroutput">CONTRACT_INVARIANT<span class="special">()</span></code> bu the later syntax will only compile
+ for C99 (so it is not recommended).
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.tutorial.function_arguments.default_arguments"></a><h6>
+<a name="contract__.tutorial.function_arguments.default_arguments-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.function_arguments.default_arguments">Default
+ Arguments</a>
+ </h6>
+<p>
+ If the contracted function has default argument values, the default values
+ are <span class="emphasis"><em>not</em></span> repeated in <span class="emphasis"><em>signature-sequence</em></span>
+ for which only the argument type and name are specified. However, the default
+ argument values specified for the contracted function work as usual and the
+ caller can omit to specify such augments when calling the contracted function:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="bold"><strong>// Do not repeat default value 0.</strong></span>
+<span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">x</span> <span class="special">>=</span> <span class="number">0</span> <span class="special">);</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="number">10</span><span class="special">)</span> <span class="special">);</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="number">10</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+<span class="special">...</span>
+<span class="keyword">int</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">();</span> <span class="bold"><strong>// y is 10 (call uses default value 0).</strong></span>
+<span class="identifier">y</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">(</span><span class="number">2</span><span class="special">);</span> <span class="comment">// y is 12.</span>
+<span class="identifier">y</span> <span class="special">=</span> <span class="identifier">f</span><span class="special">(-</span><span class="number">1</span><span class="special">);</span> <span class="comment">// Call precondition failure handler.</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.inheritance"></a><a class="link" href="tutorial.html#contract__.tutorial.inheritance" title="Inheritance">Inheritance</a>
+</h3></div></div></div>
+<p>
+ The library supports subcontracting from multiple base classes in case of
+ multiple inheritance. Contracts are for pure virtual functions are also supported
+ as usual when body definition is deferred to the derived classes (see below).
+ </p>
+<p>
+ However, note that constructors and destructors do not directly subcontract
+ (their <span class="emphasis"><em>signature-sequences</em></span> do not accept any <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span></code><span class="emphasis"><em>base-class-type</em></span><code class="computeroutput"><span class="special">)</span></code> token). This is because the C++ object construction
+ and destruction mechanism will automatically execute the code that checks
+ the base class constructor and destructor contracts if present.
+ </p>
+<a name="contract__.tutorial.inheritance.multiple_inheritance"></a><h6>
+<a name="contract__.tutorial.inheritance.multiple_inheritance-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.inheritance.multiple_inheritance">Multiple
+ Inheritance</a>
+ </h6>
+<p>
+ In case of multiple inheritance, it is possible to subcontract from multiple
+ base classes by repeating <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span></code><span class="emphasis"><em>base-class-type</em></span><code class="computeroutput"><span class="special">)</span></code> multiple times in <span class="emphasis"><em>signature-sequence</em></span>.
+ For example, assuming <code class="computeroutput"><span class="identifier">myvector</span></code>
+ is inheriting and subcontracting from <span class="emphasis"><em>both</em></span> the <code class="computeroutput"><span class="identifier">boundable</span></code> and the <code class="computeroutput"><span class="identifier">basic_begin</span></code>
+ base classes:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span>
+ <span class="keyword">public</span> <span class="bold"><strong>boundable<typename std::vector<T>::const_iterator></strong></span><span class="special">,</span>
+ <span class="keyword">private</span> <span class="bold"><strong>basic_begin<typename std::vector<T>::const_iterator></strong></span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Class invariants.</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+
+ <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="comment">// Multiple inheritance.</span>
+ <span class="bold"><strong>(inherit)(boundable<const_iterator>)</strong></span>
+ <span class="bold"><strong>(inherit)(basic_begin<const_iterator>)</strong></span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span>
+ <span class="comment">// No preconditions (omitted).</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">({</span> <span class="comment">// Return value `result` in postconditions.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="comment">// Must use CONTRACT_BODY() when calling the base function.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">basic_begin</span><span class="special"><</span><span class="identifier">const_iterator</span><span class="special">>::</span><span class="bold"><strong>CONTRACT_BODY</strong></span><span class="special">(</span><span class="identifier">begin</span><span class="special">)</span> <span class="special">==</span>
+ <span class="identifier">const_iterator</span><span class="special">())</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">const_iterator</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The subcontracted contracts are checked in the order in which their <code class="computeroutput"><span class="special">(</span><span class="identifier">inherit</span><span class="special">)</span></code> tokens are listed in <span class="emphasis"><em>signature-sequence</em></span>
+ and the derived class contracts are checked last.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ The above implies that if a derived class relaxes the precondition of an
+ overridden function, all the base contract preconditions will have be checked
+ first to fails before the relaxed preconditions of the overridden function
+ are checked to pass.
+ </p>
+<p>
+ In this case, it would appear more efficient to check the derived class
+ contract first. However, the derived class invariants could be written
+ assuming that the base class invariants hold true (for example the base
+ class invariants could assert a pointer to be not null and thus the derived
+ class invariants could deference the pointer without checking for nullity).
+ In doing so, the derived class invariants assume that they are checked
+ last in <span class="emphasis"><em>AND</em></span> with all base classes invariants. The
+ same argument can be made for postconditions. Therefore, if derived class
+ invariants (and postconditions) should be checked last in <span class="emphasis"><em>AND</em></span>
+ with all base classes invariants (and postconditions). It is natural to
+ follow the same policy and check derived class function preconditions last
+ in the <span class="emphasis"><em>OR</em></span> with all base class function preconditions
+ (even if this introduces the inefficiency to have to check and fail all
+ the base class function preconditions when a derived class function if
+ relaxing the base class function preconditions).
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.tutorial.inheritance.base_function_call"></a><h6>
+<a name="contract__.tutorial.inheritance.base_function_call-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.inheritance.base_function_call">Base Function
+ Call</a>
+ </h6>
+<p>
+ When the derived class invokes the overridden function in the base class
+ the <code class="computeroutput"><span class="identifier">CONTRACT_BODY</span><span class="special">()</span></code>
+ macro must be used:
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>base-class</em></span><span class="special">::</span><span class="identifier">CONTRACT_BODY</span><span class="special">(</span><span class="emphasis"><em>function-name</em></span><span class="special">)(...)</span>
+</pre>
+<p>
+ as illustrated by the example above. The overriding function should <span class="bold"><strong>not</strong></span> call the overridden function directly without
+ using the macro:
+ </p>
+<pre class="programlisting"><span class="emphasis"><em>base-class</em></span><span class="special">::</span><span class="emphasis"><em>function-name</em></span><span class="special">)(...)</span>
+</pre>
+<p>
+ because this call will cause the contracts to executed infinite recursive
+ calls (due to the dynamic binding of the contracted virtual base function
+ <span class="emphasis"><em>base-class</em></span><code class="computeroutput"><span class="special">::</span></code><span class="emphasis"><em>function-name</em></span>).
+ <sup>[<a name="id878216" href="#ftn.id878216" class="footnote">14</a>]</sup>
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Base Calls via CONTRACT_BODY()</strong></span>
+ </p>
+<p>
+ Overriding functions must use <span class="emphasis"><em>base-class</em></span><code class="computeroutput"><span class="special">::</span><span class="identifier">CONTRACT_BODY</span><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code> and not just <span class="emphasis"><em>base-class</em></span><code class="computeroutput"><span class="special">::</span></code><span class="emphasis"><em>function-name</em></span> when
+ calling the overridden functions (otherwise the contract calls will cause
+ infinite recursion).
+ </p>
+</td></tr>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.operators"></a><a class="link" href="tutorial.html#contract__.tutorial.operators" title="Operators">Operators</a>
+</h3></div></div></div>
+<p>
+ The library supports contracts for operators.
+ </p>
+<p>
+ For operators, the <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code> token in <span class="emphasis"><em>signature-sequence</em></span>
+ must contain both the operator symbol and the operator <span class="emphasis"><em>name</em></span>
+ spelled out in words without using any special symbol (this is necessary
+ because, in general, the operator special symbols (<code class="computeroutput"><span class="special">[]</span></code>,
+ <code class="computeroutput"><span class="special">==</span></code>, <code class="computeroutput"><span class="special"><<</span></code>,
+ etc) are not valid preprocessor tokens). For operators, <code class="computeroutput"><span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code> takes the following form:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="keyword">operator</span><span class="special">(</span><span class="emphasis"><em>symbol</em></span><span class="special">,</span> <span class="emphasis"><em>name</em></span><span class="special">))</span>
+</pre>
+<p>
+ Note the necessary double closing parenthesis <code class="computeroutput"><span class="string">"))"</span></code>
+ at the end. For example:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Class invariants.</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+ <span class="identifier">const_reference</span> *operator[]*<span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">index</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> *(operator([]*<span class="bold"><strong>, at))</strong></span><span class="special">(</span>
+ <span class="special">(</span><span class="identifier">size_type</span><span class="special">)(</span><span class="identifier">index</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">index</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="comment">// No postconditions (omitted).</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">index</span><span class="special">];</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The operator name, in this example <code class="computeroutput"><span class="string">"at"</span></code>,
+ is arbitrary and any name without special symbols can been used.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.overloaded_functions"></a><a class="link" href="tutorial.html#contract__.tutorial.overloaded_functions" title="Overloaded Functions">Overloaded
+ Functions</a>
+</h3></div></div></div>
+<p>
+ The library supports contracts for overloaded functions.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ However, the library uses the argument <span class="bold"><strong>names</strong></span>
+ to distinguish the overloaded function signatures whereas C++ uses the
+ argument types (this is because, in general, the argument types, for example
+ <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span></code>, are not valid preprocessor tokens).
+ </p>
+<p>
+ If two functions share the same name, the same number of arguments, and
+ the same <code class="computeroutput"><span class="keyword">const</span></code> qualifier then
+ their argument names (and not just their types) must be different to allow
+ the library to distinguish these two functions from each other. (This is
+ usually not a significant limitation because different argument names can
+ be given.)
+ </p>
+</td></tr>
+</table></div>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">number</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="comment">// Overloaded functions distinguished using argument names (not types) and const.</span>
+
+ <span class="identifier">number</span> <span class="identifier">add</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="comment">// (1)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(...)</span>
+
+ <span class="comment">// OK -- different from (1) because this is `const`.</span>
+ <span class="identifier">number</span><span class="special">&</span> <span class="identifier">add</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(...)</span>
+
+ <span class="comment">// OK -- different from (1) because argument named "d" instead of "n".</span>
+ <span class="identifier">number</span> <span class="identifier">add</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">d</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(...)</span>
+
+ <span class="comment">// Error -- same as (1) because both non-const and with argument named "n" (even if different argument type).</span>
+ <span class="identifier">number</span> <span class="identifier">add</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(...)</span> <span class="comment">// Same as (1), error!</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.function_templates"></a><a class="link" href="tutorial.html#contract__.tutorial.function_templates" title="Function Templates">Function Templates</a>
+</h3></div></div></div>
+<p>
+ The <code class="computeroutput"><span class="special">(</span><span class="keyword">template</span><span class="special">)</span></code> token is used in <span class="emphasis"><em>signature-sequence</em></span>
+ to specify a function template listing the relative template parameters.
+ The template parameters are specified using a syntax similar to the one of
+ the function arguments.
+ </p>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Class invariants.</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="bold"><strong>template<class Iter></strong></span>
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">private</span><span class="special">)</span> <span class="bold"><strong>(template)( (class)(Iter) )</strong></span>
+ <span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">(</span><span class="keyword">bool</span><span class="special">)</span> <span class="special">(</span><span class="identifier">all_equals</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">Iter</span><span class="special">)(</span><span class="identifier">first</span><span class="special">)</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)(</span><span class="identifier">last</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">first</span> <span class="special"><</span> <span class="identifier">last</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="special">};</span>
+</pre>
+<p>
+ In this example, the function also happens to be a static member but any
+ function (non-member, member, static member, constructor, etc) can be be
+ declared a template function as usual in C++.
+ </p>
+<p>
+ In principle, the library also supports contracts for <code class="computeroutput"><span class="keyword">export</span></code>
+ class and function templates. For non-member function templates <code class="computeroutput"><span class="special">(</span><span class="keyword">export</span><span class="special">)</span></code>
+ can be specified within the <span class="emphasis"><em>signature-sequence</em></span> as usual.
+ However, most compilers do not support <code class="computeroutput"><span class="keyword">export</span></code>
+ templates and this library feature has not being tested.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.deferring_the_body"></a><a class="link" href="tutorial.html#contract__.tutorial.deferring_the_body" title="Deferring the Body">Deferring the
+ Body</a>
+</h3></div></div></div>
+<p>
+ Class invariants, preconditions, and postconditions are part of the function
+ specifications (indeed they <span class="emphasis"><em>assert</em></span> the function specifications).
+ Therefore, this library requires contracts to be defined together with the
+ function declarations. However, the function body (i.e., the function implementation)
+ can be defined either together with the function declaration or separately.
+ </p>
+<p>
+ In other words, the usual C++ feature that allows to separate a function
+ definition from its declaration is retained by this library.
+ </p>
+<a name="contract__.tutorial.deferring_the_body.separating_declaration_and_definition"></a><h6>
+<a name="contract__.tutorial.deferring_the_body.separating_declaration_and_definition-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.deferring_the_body.separating_declaration_and_definition">Separating
+ Declaration and Definition</a>
+ </h6>
+<p>
+ When the function body is defined separately from the function declaration:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)(;)</span></code> tokens are used to define the body
+ in the macro parameter passed to <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code>. The <code class="computeroutput"><span class="string">";"</span></code>
+ symbol is the usual C++ symbol used to separate the function definition
+ from its declaration.
+ </li>
+<li class="listitem">
+ The <code class="computeroutput">CONTRACT_BODY<span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code> macro is used to name the function where
+ it is defined. Again, for operators <span class="emphasis"><em>function-name</em></span>
+ must be specified as <code class="computeroutput"><span class="keyword">operator</span><span class="special">(</span></code><span class="emphasis"><em>symbol</em></span><code class="computeroutput"><span class="special">,</span> </code><span class="emphasis"><em>name</em></span><code class="computeroutput"><span class="special">)</span></code>.
+ </li>
+<li class="listitem">
+ Similarly, it is possible to separate constructor and destructor body
+ definitions. In this case, the macros <code class="computeroutput">CONTRACT_CONSTRUCTOR_BODY<span class="special">(</span></code><span class="emphasis"><em>class-type</em></span><code class="computeroutput"><span class="special">,</span> </code><span class="emphasis"><em>class-name</em></span><code class="computeroutput"><span class="special">)</span></code> and <code class="computeroutput">CONTRACT_DESTRUCTOR_BODY<span class="special">(</span></code><span class="emphasis"><em>class-type</em></span><code class="computeroutput"><span class="special">,</span> </code><span class="emphasis"><em>class-name</em></span><code class="computeroutput"><span class="special">)</span></code> should be used when the constructor
+ and destructor are defined respectively (note again that <code class="computeroutput"><span class="string">"~"</span></code> is <span class="emphasis"><em>not</em></span>
+ specified to name destructors, just use the class name instead).
+ </li>
+</ul></div>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="comment">// Declarations (usually in header files).</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span>
+ <span class="keyword">public</span> <span class="identifier">boundable</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">>,</span>
+ <span class="keyword">private</span> <span class="identifier">basic_begin</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Class invariants.</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+
+ <span class="identifier">myvector</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">right</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&)(</span><span class="identifier">right</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">vector_</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="bold"><strong>;</strong></span> <span class="comment">// Deferres body definition.</span>
+ <span class="special">)</span> <span class="special">)</span>
+
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">myvector</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_DESTRUCTOR</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)(</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">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="bold"><strong>;</strong></span>
+ <span class="special">)</span> <span class="special">)</span>
+
+ <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span><span class="identifier">boundable</span><span class="special"><</span><span class="identifier">const_iterator</span><span class="special">>)</span>
+ <span class="special">(</span><span class="identifier">inherit</span><span class="special">)(</span><span class="identifier">basic_begin</span><span class="special"><</span><span class="identifier">const_iterator</span><span class="special">>)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> <span class="special">({</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="bold"><strong>;</strong></span>
+ <span class="special">)</span> <span class="special">)</span>
+
+ <span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span> <span class="identifier">index</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="special">(</span><span class="keyword">operator</span><span class="special">([],</span> <span class="identifier">at</span><span class="special">))(</span>
+ <span class="special">(</span><span class="identifier">size_type</span><span class="special">)(</span><span class="identifier">index</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">index</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="bold"><strong>;</strong></span>
+ <span class="special">)</span> <span class="special">)</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// Separated definitions (eventually in a different file).</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="bold"><strong>CONTRACT_CONSTRUCTOR_BODY(myvector<T>, myvector)</strong></span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">right</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span> <span class="special">=</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="bold"><strong>CONTRACT_DESTRUCTOR_BODY(myvector<T>, myvector)</strong></span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Do nothing in this case.</span>
+<span class="special">}</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="bold"><strong>CONTRACT_BODY(begin)</strong></span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+<span class="special">}</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span>
+ *CONTRACT_BODY(operator([]*<span class="bold"><strong>, at))</strong></span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">index</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">index</span><span class="special">];</span>
+<span class="special">}</span>
+</pre>
+<p>
+ In addition to the usual benefits of separating function definitions from
+ their declarations (smaller and more readable header files, less recompilation
+ needed, etc), this separation also improves the library compile-time error
+ messages. When a function is defined together with its declaration, the function
+ implementation code is passed as one single macro parameter <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)({</span>
+ <span class="special">...</span> <span class="special">})</span></code>
+ to the contract macros. Macro preprocessing removes all newline characters
+ from within the macro parameters so the implementation code is compiled as
+ if it were written on a single line. As a result, any compile-time error
+ within the function body code will be reported having the same line number
+ and it will be harder to track. Instead, if the body definition is separated
+ from the function declaration, the definition code is not wrapped within
+ a macro parameter and the compiler errors will indicate useful line numbers.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ It is recommended to separate the body definition from the function declaration
+ so that line numbers in compiler errors retain their usual values.
+ </p></td></tr>
+</table></div>
+<p>
+ Finally, note how the <span class="emphasis"><em>signature-sequence</em></span> unusual syntax
+ does <span class="emphasis"><em>not</em></span> propagate to the function definitions (only
+ the function name is changed in the function definitions). Therefore, when
+ definitions are separated from declarations, the files containing the definitions
+ (usually the ".cpp" files) will not contain the unusual <span class="emphasis"><em>signature-sequence</em></span>
+ syntax and they will be easier to read.
+ </p>
+<div class="warning"><table border="0" summary="Warning">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../images/warning.png"></td>
+<th align="left">Warning</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Constructor Member Initialization List</strong></span>
+ </p>
+<p>
+ Because of a library limitation, it is not possible to separate a constructor
+ definition from its declaration when the constructor uses a member initialization
+ list (see <code class="computeroutput">CONTRACT_CONSTRUCTOR_BODY<span class="special">()</span></code> macro for details and workarounds) <sup>[<a name="id883219" href="#ftn.id883219" class="footnote">15</a>]</sup>.
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.tutorial.deferring_the_body.pure_virtual_functions"></a><h6>
+<a name="contract__.tutorial.deferring_the_body.pure_virtual_functions-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.deferring_the_body.pure_virtual_functions">Pure
+ Virtual Functions</a>
+ </h6>
+<p>
+ The library also supports contracts for pure virtual functions.
+ </p>
+<p>
+ In this case, the <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)(=</span> <span class="number">0</span><span class="special">;)</span></code>
+ tokens are used to define the body in the macro parameter passed to <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code>.
+ The <code class="computeroutput"><span class="string">"= 0;"</span></code> symbol is
+ the usual C++ symbol used to specify pure virtual functions.
+ </p>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">pushable</span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="special">(</span><span class="keyword">class</span><span class="special">)</span> <span class="special">(</span><span class="identifier">pushable</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">virtual</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">back</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">element</span> <span class="special">);</span>
+ <span class="special">})</span>
+ <span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">(</span>
+ <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="special">)</span> <span class="special">)</span> <span class="comment">// Pure virtual body.</span>
+<span class="special">};</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.friends"></a><a class="link" href="tutorial.html#contract__.tutorial.friends" title="Friends">Friends</a>
+</h3></div></div></div>
+<p>
+ The library supports contracts for friend non-member functions (and friend
+ classes work as usual).
+ </p>
+<p>
+ However, when a friend non-member function is contracted:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The function definition must always be separated from its friendship
+ declaration (whereas, C++ allows to define friends function in place
+ together with they friendship declarations).
+ </li>
+<li class="listitem">
+ The body function <code class="computeroutput">CONTRACT_BODY<span class="special">(</span></code><span class="emphasis"><em>function-name</em></span><code class="computeroutput"><span class="special">)</span></code>, and not the contracted function <span class="emphasis"><em>function-name</em></span>,
+ must be declared friend using .
+ </li>
+</ol></div>
+<p>
+ For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">point</span> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">point</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">y</span><span class="special">):</span> <span class="identifier">x_</span><span class="special">(</span><span class="identifier">x</span><span class="special">),</span> <span class="identifier">y_</span><span class="special">(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">bool</span> <span class="identifier">printable</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="special">}</span> <span class="comment">// Dummy implementation.</span>
+
+ <span class="comment">// Forward declare body as friend.</span>
+ <span class="keyword">friend</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">CONTRACT_NONMEMBER_BODY</span><span class="special">(</span><span class="keyword">operator</span><span class="special">(<<,</span> <span class="identifier">out</span><span class="special">))(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">point</span><span class="special">&</span> <span class="identifier">o</span><span class="special">);</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">double</span> <span class="identifier">x_</span><span class="special">;</span>
+ <span class="keyword">double</span> <span class="identifier">y_</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&)</span> <span class="special">(</span><span class="keyword">operator</span><span class="special">(<<,</span> <span class="identifier">out</span><span class="special">))(</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&)(</span><span class="identifier">s</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">point</span><span class="special">&)(</span><span class="identifier">o</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">o</span><span class="special">.</span><span class="identifier">printable</span><span class="special">())</span> <span class="special">)</span>
+<span class="special">({</span>
+ <span class="keyword">return</span> <span class="identifier">s</span> <span class="special"><<</span> <span class="string">"("</span> <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">x_</span> <span class="special"><<</span> <span class="string">", "</span> <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">y_</span> <span class="special"><<</span> <span class="string">")"</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.structs_and_unions"></a><a class="link" href="tutorial.html#contract__.tutorial.structs_and_unions" title="Structs and Unions">Structs and Unions</a>
+</h3></div></div></div>
+<p>
+ Note that <code class="computeroutput"><span class="special">(</span><span class="keyword">class</span><span class="special">)</span></code> and <code class="computeroutput"><span class="special">(</span><span class="keyword">struct</span><span class="special">)</span></code> can
+ be used interchangeably in the <span class="emphasis"><em>signature-sequence</em></span> as
+ the library makes <span class="emphasis"><em>no</em></span> differentiation between contracts
+ for classes and a structs. However, as always remember:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ To always specify the member access level <code class="computeroutput"><span class="special">(</span><span class="keyword">public</span><span class="special">)</span></code>,
+ etc.
+ </li>
+<li class="listitem">
+ To use <code class="computeroutput">CONTRACT_INVARIANT<span class="special">()</span></code> in a private section also for <code class="computeroutput"><span class="keyword">struct</span></code>.
+ </li>
+<li class="listitem">
+ That no contract is checked (not event the class invariants) when member
+ variables are accessed directly (so it might be best for the <code class="computeroutput"><span class="keyword">struct</span></code> to have no non-constant public
+ member variable).
+ </li>
+</ol></div>
+<p>
+ For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">positive</span> <span class="special">{</span>
+ <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">number</span><span class="special">;</span>
+
+<span class="keyword">private</span><span class="special">:</span> <span class="comment">// Alway contract class (invariants, etc) in a private section at top.</span>
+ <span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">positive</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">number</span> <span class="special">></span> <span class="number">0.0</span><span class="special">)</span>
+ <span class="special">)</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span> <span class="comment">// Remember to always specify the access level (public, etc).</span>
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="identifier">positive</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="identifier">number</span><span class="special">(</span><span class="identifier">n</span><span class="special">))</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">></span> <span class="number">0.0</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">({</span>
+ <span class="special">})</span> <span class="special">)</span>
+<span class="special">};</span>
+
+</pre>
+<p>
+ </p>
+<p>
+ This library does <span class="emphasis"><em>not</em></span> support contracts for unions and
+ <code class="computeroutput"><span class="special">(</span><span class="keyword">union</span><span class="special">)</span></code> cannot be specified in the <span class="emphasis"><em>signature-sequence</em></span>.
+ Contracts for unions are not supported because union member variable allocations
+ overlap and they cannot have constructors instead the library needs to augment
+ the object state using a (non overlapping) <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>state</code>
+ member variable with a default constructor to disable invariant checking
+ in nested function calls.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.qualifiers"></a><a class="link" href="tutorial.html#contract__.tutorial.qualifiers" title="Qualifiers">Qualifiers</a>
+</h3></div></div></div>
+<p>
+ This library supports contracts also when constant, linkage, storage, etc
+ qualifiers are specified.
+ </p>
+<a name="contract__.tutorial.qualifiers.const_and_volatile"></a><h6>
+<a name="contract__.tutorial.qualifiers.const_and_volatile-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.qualifiers.const_and_volatile">Const and
+ Volatile</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="keyword">const</span></code> and <code class="computeroutput"><span class="keyword">volatile</span></code> qualifiers are repeated in the <span class="emphasis"><em>signature-sequence</em></span>
+ and they can be used as usual. However, when they are both specified they
+ must appear in the order <code class="computeroutput"><span class="special">(</span><span class="keyword">const</span><span class="special">)</span> <span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span></code> and not <code class="computeroutput"><span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span></code>.
+ </p>
+<p>
+ The invariant, precondition, and postcondition functions are always <code class="computeroutput"><span class="keyword">const</span></code> to ensure contract constant-correctness.
+ In addition, the eventual <code class="computeroutput"><span class="keyword">const</span></code>
+ and <code class="computeroutput"><span class="keyword">volatile</span></code> qualifiers specified
+ for the contracted function are applied to the body, precondition, and postcondition
+ functions as well. Therefore, applying the usual <code class="computeroutput"><span class="keyword">const</span>
+ <span class="keyword">volatile</span></code> semantics, note the followings:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Class invariants can access any <code class="computeroutput"><span class="keyword">const</span></code>
+ and <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">volatile</span></code>
+ member.
+ </li>
+<li class="listitem">
+ Preconditions and postconditions of non-<code class="computeroutput"><span class="keyword">const</span></code>
+ and <code class="computeroutput"><span class="keyword">const</span></code> members can access
+ any <code class="computeroutput"><span class="keyword">const</span></code> and <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">volatile</span></code>
+ member.
+ </li>
+<li class="listitem">
+ Preconditions and postconditions of <code class="computeroutput"><span class="keyword">volatile</span></code>
+ members can only access <code class="computeroutput"><span class="keyword">const</span>
+ <span class="keyword">volatile</span></code> members.
+ </li>
+<li class="listitem">
+ If a <code class="computeroutput"><span class="keyword">volatile</span></code> member function
+ tags the class type <code class="computeroutput"><span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span></code> so to use the object old value in postconditions
+ then the object old value is, as well as the object current value, <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">volatile</span></code>
+ qualified and therefore programmers must specify a constant-correct copy
+ constructor for the <code class="computeroutput"><span class="keyword">volatile</span></code>
+ object type otherwise the library will generate a compile-time error
+ (note that C++ will automatically synthesize only the constant-correct
+ copy constructor the the original class type and not for the <code class="computeroutput"><span class="keyword">volatile</span></code> class type).
+ </li>
+</ol></div>
+<p>
+ For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">z</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">b</span> <span class="special">{</span> <span class="comment">// Some base class b to show subcontracting.</span>
+
+ <span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">z</span><span class="special">)</span> <span class="special">(</span><span class="keyword">public</span><span class="special">)(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">invariant</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">check_c</span><span class="special">()</span> <span class="special">&&</span> <span class="identifier">check_cv</span><span class="special">())</span> <span class="comment">// const</span>
+ <span class="special">)</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">z</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="comment">// For old object, must manually program const-correct copy</span>
+ <span class="comment">// constructor for volatile type (instead use `z(constz&)`</span>
+ <span class="comment">// automatically synthesized by C++ for non-volatile type).</span>
+ <span class="identifier">z</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">volatile</span> <span class="identifier">z</span><span class="special">&</span> <span class="identifier">source</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</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">copyable</span><span class="special">)</span> <span class="comment">// no-cv</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">check_c</span><span class="special">()</span> <span class="special">&&</span> <span class="identifier">check_cv</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// const</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">check_c</span><span class="special">()</span> <span class="special">&&</span> <span class="identifier">check_cv</span><span class="special">())</span> <span class="comment">// const</span>
+ <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_c</span><span class="special">()</span> <span class="comment">// oldof(this) also const</span>
+ <span class="special">&&</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_cv</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">({</span> <span class="comment">// no-cv</span>
+ <span class="identifier">check_nocv</span><span class="special">();</span> <span class="identifier">check_c</span><span class="special">();</span> <span class="identifier">check_v</span><span class="special">();</span> <span class="identifier">check_cv</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">check_c</span><span class="special">()</span> <span class="special">&&</span> <span class="identifier">check_cv</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// const</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">check_c</span><span class="special">()</span> <span class="special">&&</span> <span class="identifier">check_cv</span><span class="special">())</span> <span class="comment">// const</span>
+ <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_c</span><span class="special">()</span> <span class="comment">// oldof(this) also const</span>
+ <span class="special">&&</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_cv</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">({</span> <span class="comment">// const</span>
+ <span class="identifier">check_c</span><span class="special">();</span> <span class="identifier">check_cv</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">2</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">check_cv</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// const volatile</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">check_cv</span><span class="special">())</span> <span class="comment">// const volatile</span>
+ <span class="comment">// oldof(this) also const volatile</span>
+ <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_cv</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">({</span> <span class="comment">// volatile</span>
+ <span class="identifier">check_v</span><span class="special">();</span> <span class="identifier">check_cv</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">3</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="comment">// const must appear before volatile in signature</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">f</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="special">(</span><span class="keyword">const</span><span class="special">)</span> <span class="special">(</span><span class="keyword">volatile</span><span class="special">)</span> <span class="special">(</span><span class="identifier">copyable</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">check_cv</span><span class="special">())</span> <span class="special">)</span> <span class="comment">// const volatile</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span>
+ <span class="special">(</span><span class="identifier">check_cv</span><span class="special">())</span> <span class="comment">// const volatile</span>
+ <span class="comment">// oldof(this) also const volatile</span>
+ <span class="special">(</span><span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="keyword">this</span><span class="special">)-></span><span class="identifier">check_cv</span><span class="special">())</span>
+ <span class="special">)</span>
+ <span class="special">({</span> <span class="comment">// const volatile</span>
+ <span class="identifier">check_cv</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="number">4</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="comment">// Used to demonstrate qualified member access constraints.</span>
+ <span class="keyword">bool</span> <span class="identifier">check_nocv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">check_c</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">check_v</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">volatile</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">check_cv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">volatile</span> <span class="special">{</span> <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+</pre>
+<p>
+ </p>
+<p>
+ Note that the cv-qualifier is used to resolve overloading as usual (so there
+ is no need to use different argument names). Also subcontracting works as
+ usual for cv-qualified member functions (as shown by the base class <code class="computeroutput"><span class="identifier">b</span></code> in this example).
+ </p>
+<a name="contract__.tutorial.qualifiers.inline"></a><h6>
+<a name="contract__.tutorial.qualifiers.inline-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.qualifiers.inline">Inline</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="keyword">inline</span></code> qualifier is repeated
+ in the <span class="emphasis"><em>signature-sequence</em></span> and it is used as usual. For
+ example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">z</span> <span class="special">{</span>
+
+ <span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">z</span><span class="special">)</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">inline</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">inl</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">({</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">})</span> <span class="special">)</span>
+<span class="special">};</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">inline</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">inl</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span>
+<span class="special">({</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+</pre>
+<p>
+ </p>
+<a name="contract__.tutorial.qualifiers.extern_and_static"></a><h6>
+<a name="contract__.tutorial.qualifiers.extern_and_static-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.qualifiers.extern_and_static">Extern and
+ Static</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="keyword">extern</span></code> linkage qualifier
+ is repeated in the <span class="emphasis"><em>signature-sequence</em></span> for non-member
+ functions and it is used as usual. For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">extern</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">ext</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// External linkage.</span>
+<span class="special">({</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">extern</span> <span class="string">"C"</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">ext_c</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// External linkage callable from C.</span>
+<span class="special">({</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+</pre>
+<p>
+ </p>
+<p>
+ The <code class="computeroutput"><span class="keyword">static</span></code> qualifier is used
+ as usual for static member functions and it is specified in <span class="emphasis"><em>signature-sequence</em></span>.
+ The <code class="computeroutput"><span class="keyword">static</span></code> qualifier for non-member
+ functions to indicate non-members local to a translation unit was deprecated
+ from C to C++ (see [Stroustrup1997]) therefore it is not supported by this
+ library and it cannot be specified in <span class="emphasis"><em>signature-sequence</em></span>.
+ </p>
+<a name="contract__.tutorial.qualifiers.auto_and_register"></a><h6>
+<a name="contract__.tutorial.qualifiers.auto_and_register-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.qualifiers.auto_and_register">Auto and
+ Register</a>
+ </h6>
+<p>
+ The <code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>
+ storage qualifiers are <span class="emphasis"><em>not</em></span> repeated in the <span class="emphasis"><em>signature-sequence</em></span>
+ but they can appear in the contracted function as usual. When these qualifiers
+ are used, they will have effect for the contracted function but not for the
+ contract (i.e., these qualifier will not be applied to the precondition,
+ postcondition, and body function arguments). For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">(</span><span class="identifier">square</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">auto</span><span class="special">)(</span><span class="keyword">double</span><span class="special">)(</span><span class="identifier">d</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// `auto` storage classifier.</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">result</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">d</span> <span class="special">*</span> <span class="identifier">d</span><span class="special">))</span> <span class="special">)</span>
+<span class="special">({</span>
+ <span class="keyword">auto</span> <span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">d</span> <span class="special">*</span> <span class="identifier">d</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">y</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">(</span><span class="identifier">square</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">register</span><span class="special">)(</span><span class="keyword">int</span><span class="special">)(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// `register` storage classifier.</span>
+ <span class="special">(</span><span class="identifier">postcondition</span><span class="special">)(</span><span class="identifier">result</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">result</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">i</span> <span class="special">*</span> <span class="identifier">i</span><span class="special">))</span> <span class="special">)</span>
+<span class="special">({</span>
+ <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">i</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">y</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.blocks_and_loops"></a><a class="link" href="tutorial.html#contract__.tutorial.blocks_and_loops" title="Blocks and Loops">Blocks and Loops</a>
+</h3></div></div></div>
+<p>
+ Block invariants <code class="computeroutput">CONTRACT_ASSERT_BLOCK_INVARIANT<span class="special">()</span></code> can be used to assert conditions anywhere
+ within a code block (not just loops). When used within a loop, block invariants
+ can be used to assert loop invariants.
+ </p>
+<p>
+ Loop variants can be used to check the correctness of a loop, including its
+ termination, as explained in detail in <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a>
+ (and they can only appear within loops). At each loop iteration, the specified
+ loop variant integer expression is automatically asserted to be positive
+ (> 0) and to decrease from the previous loop iteration. Loop variants
+ can be used to assert loop correctness. Because the variant decreases and
+ it cannot be zero or smaller than zero it is possible to guarantee loop termination.
+ A loop can only have one variant.
+ </p>
+<p>
+ When asserting loop variants using <code class="computeroutput">CONTRACT_ASSERT_LOOP_VARIANT<span class="special">()</span></code> it is necessary to first call <code class="computeroutput">CONTRACT_INIT_LOOP_VARIANT</code>
+ once (and only once) within a code block that has same of higher scope level
+ than the loop code block.
+ </p>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">abs_total</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span><span class="special">)</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">(</span><span class="identifier">abs_total</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&)(</span><span class="identifier">vector</span><span class="special">)</span> <span class="special">)</span>
+<span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">(</span><span class="identifier">total</span><span class="special">)</span> <span class="special">({</span> <span class="comment">// Result value named `total`.</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">total</span> <span class="special">>=</span> <span class="number">0.0</span> <span class="special">);</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="keyword">double</span> <span class="identifier">total</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="comment">// Block invariants can appear anywhere in code block.</span>
+ <span class="bold"><strong>CONTRACT_ASSERT_BLOCK_INVARIANT( total == 0.0 );</strong></span>
+
+ <span class="special">{</span> <span class="comment">// Variant initialized locally to its loop.</span>
+ <span class="bold"><strong>CONTRACT_INIT_LOOP_VARIANT;</strong></span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Block invariants used to assert loop invariants.</span>
+ <span class="bold"><strong>CONTRACT_ASSERT_BLOCK_INVARIANT( i < vector.size() );</strong></span>
+ <span class="comment">// Loop variant (can only appear in loops).</span>
+ <span class="bold"><strong>CONTRACT_ASSERT_LOOP_VARIANT( vector.size() - i );</strong></span>
+
+ <span class="identifier">total</span> <span class="special">+=</span> <span class="identifier">vector</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="identifier">total</span> <span class="special"><</span> <span class="number">0.0</span> <span class="special">?</span> <span class="special">-</span><span class="identifier">total</span> <span class="special">:</span> <span class="identifier">total</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.exception_specifications"></a><a class="link" href="tutorial.html#contract__.tutorial.exception_specifications" title="Exception Specifications">Exception
+ Specifications</a>
+</h3></div></div></div>
+<p>
+ Exception specifications are <span class="emphasis"><em>not</em></span> repeated in the <span class="emphasis"><em>signature-sequence</em></span>
+ but they can be specified for contracted member functions as usual.
+ </p>
+<p>
+ However, non-member functions with exception specifications cannot be contracted
+ (the library will generated a compile-time error otherwise). A possible workaround
+ for this library limitation is to make the non-member functions with exception
+ specifications static members of some artificially introduced class so they
+ can be contracted. For example:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">c</span> <span class="special">{</span> <span class="comment">// Some artificially introduced class.</span>
+
+ <span class="identifier">CONTRACT_CLASS</span><span class="special">(</span> <span class="special">(</span><span class="identifier">c</span><span class="special">)</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">some</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&)(</span><span class="identifier">what</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">char</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// Exception specifications.</span>
+ <span class="special">({</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">what</span> <span class="special">==</span> <span class="string">"none"</span><span class="special">)</span> <span class="keyword">return</span><span class="special">;</span> <span class="comment">// OK.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">what</span> <span class="special">==</span> <span class="string">"char"</span><span class="special">)</span> <span class="keyword">throw</span> <span class="keyword">char</span><span class="special">(</span><span class="char">'a'</span><span class="special">);</span> <span class="comment">// OK.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">what</span> <span class="special">==</span> <span class="string">"int"</span><span class="special">)</span> <span class="keyword">throw</span> <span class="keyword">int</span><span class="special">(-</span><span class="number">1</span><span class="special">);</span> <span class="comment">// OK.</span>
+ <span class="keyword">throw</span> <span class="identifier">what</span><span class="special">;</span> <span class="comment">// Not in specs so terminate() is called.</span>
+ <span class="special">})</span> <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span> <span class="comment">// Ex. specs not repeated in signature.</span>
+ <span class="special">(</span><span class="keyword">public</span><span class="special">)</span> <span class="special">(</span><span class="keyword">static</span><span class="special">)</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">(</span><span class="identifier">none</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&)(</span><span class="identifier">what</span><span class="special">)</span> <span class="special">)</span>
+ <span class="special">(</span><span class="keyword">throw</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// Exception specifications (throw nothing).</span>
+ <span class="special">({</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">what</span> <span class="special">==</span> <span class="string">"none"</span><span class="special">)</span> <span class="keyword">return</span><span class="special">;</span> <span class="comment">// OK.</span>
+ <span class="keyword">throw</span> <span class="identifier">what</span><span class="special">;</span> <span class="comment">// Not in specs so terminate() is called.</span>
+ <span class="special">})</span> <span class="special">)</span>
+<span class="special">};</span>
+
+</pre>
+<p>
+ </p>
+<p>
+ The library uses the following rules to handle exceptions thrown by the contracts:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ When an exception is thrown while checking invariants, preconditions,
+ or postconditions then the contract condition is considered <span class="emphasis"><em>failed</em></span>
+ (because it was not possible to check it to be true) so the relative
+ contract failure handler function is invoked.
+ </li>
+<li class="listitem">
+ When an exception is thrown while executing the body then the class invariants
+ are checked (for member functions only) and, if they hold true, the exception
+ is passed up to the caller as usual (otherwise the class invariant failed
+ handler function is invoked).
+ </li>
+</ol></div>
+<p>
+ Therefore, exception specifications work as usual as long as the member function
+ body does not fail the class invariant when it throws the exception. Furthermore,
+ if the contract failure handlers are redefined to throw exceptions (instead
+ of calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">terminate</span><span class="special">()</span></code>,
+ see <a class="link" href="throw_on_failure.html" title="Annex: Throw on Failure">Throw on Failure</a>)
+ then the exception specifications still work as usual because they apply
+ to both the exceptions thrown by the body and the exceptions thrown by the
+ contract failure handlers.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.commas_within_macro_parameters"></a><a class="link" href="tutorial.html#contract__.tutorial.commas_within_macro_parameters" title="Commas Within Macro Parameters">Commas
+ Within Macro Parameters</a>
+</h3></div></div></div>
+<p>
+ The C++ preprocessor only recognizes the <code class="computeroutput"><span class="special">()</span></code>
+ parenthesis. It does not recognize any other parenthesis such as <code class="computeroutput"><span class="special"><></span></code>, <code class="computeroutput"><span class="special">[]</span></code>,
+ or <code class="computeroutput"><span class="special">{}</span></code>. As a consequence, any
+ comma passed within a macro parameter that is not wrapped by the <code class="computeroutput"><span class="special">()</span></code> parenthesis will be interpreted by the
+ preprocessor as a parameter separation token and will generate a preprocessing
+ error. Also macro parameters passed as elements of Boost.Preprocessor
+ sequences cannot contain commas not wrapped by extra <code class="computeroutput"><span class="special">()</span></code>
+ parenthesis (the preprocessor sequence <code class="computeroutput"><span class="special">()</span></code>
+ parenthesis are not sufficient to wrap the commas).
+ </p>
+<p>
+ Consider the following example:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">K</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span> <span class="identifier">fill</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&</span> <span class="identifier">source</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">K</span><span class="special">&</span> <span class="identifier">key</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">typename</span><span class="special">)(</span><span class="identifier">K</span><span class="special">)</span> <span class="special">(</span><span class="keyword">typename</span><span class="special">)(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">)</span>
+ <span class="comment">// Commas within another type expression.</span>
+ <span class="bold"><strong>(std::map<K, T>)</strong></span> <span class="special">(</span><span class="identifier">set</span><span class="special">)(</span>
+ <span class="comment">// Commas within a type expression.</span>
+ <span class="bold"><strong>(const std::map<K, T>&)</strong></span><span class="special">(</span><span class="identifier">source</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">K</span><span class="special">&)(</span><span class="identifier">key</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span> <span class="special">)</span>
+<span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">({</span>
+ <span class="comment">// Commas within a value expression.</span>
+ <span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="bold"><strong>std::map<K, T>().empty()</strong></span> <span class="special">);</span>
+<span class="special">})</span>
+<span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({</span>
+ <span class="special">...</span>
+<span class="special">})</span> <span class="special">)</span>
+</pre>
+<a name="contract__.tutorial.commas_within_macro_parameters.value_expressions"></a><h6>
+<a name="contract__.tutorial.commas_within_macro_parameters.value_expressions-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.commas_within_macro_parameters.value_expressions">Value
+ Expressions</a>
+ </h6>
+<p>
+ The example above will <span class="emphasis"><em>not</em></span> compile because the preprocessor
+ will interpret the expression:
+ </p>
+<pre class="programlisting"><span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">()</span> <span class="special">);</span>
+</pre>
+<p>
+ as a call to the macro <code class="computeroutput">CONTRACT_ASSERT<span class="special">()</span></code> passing <span class="emphasis"><em>two</em></span> parameters
+ separated by the comma:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span> <span class="comment">// 1st macro parameter.</span>
+<span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">()</span> <span class="comment">// 2nd macro parameter.</span>
+</pre>
+<p>
+ Because <code class="computeroutput">CONTRACT_ASSERT<span class="special">()</span></code> takes only one parameter, the above code
+ will generate a preprocessing error.
+ </p>
+<p>
+ The expressions <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">()</span></code> is interpreted by the compiler as a value
+ expression (it will be either be <code class="computeroutput"><span class="keyword">true</span></code>
+ or <code class="computeroutput"><span class="keyword">false</span></code>). Value expressions
+ can be wrapped by an extra set of parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ when passed as macro parameters. The following will compile:
+ </p>
+<pre class="programlisting"><span class="identifier">CONTRACT_ASSERT</span><span class="special">(</span> <span class="bold"><strong>(</strong></span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">()</span><span class="bold"><strong>)</strong></span> <span class="special">);</span>
+</pre>
+<a name="contract__.tutorial.commas_within_macro_parameters.type_expressions"></a><h6>
+<a name="contract__.tutorial.commas_within_macro_parameters.type_expressions-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.commas_within_macro_parameters.type_expressions">Type
+ Expressions</a>
+ </h6>
+<p>
+ A similar issue arises for the preprocessor sequence element:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>)</span>
+</pre>
+<p>
+ which will be interpreted as composed of 2 parameters separated by the comma
+ (i.e., as a Boost.Preprocessor
+ 2-tuple instead than an element of a Boost.Preprocessor
+ sequence):
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">T</span> <span class="comment">// 1st macro parameter.</span>
+<span class="identifier">T</span><span class="special">></span> <span class="comment">// 2nd macro parameter.</span>
+</pre>
+<p>
+ However, in this case the expression <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span></code> needs to be interpreted by the compiler
+ as a type expression (indeed the type <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span></code>) and it cannot be wrapped by the extra
+ parenthesis <code class="computeroutput"><span class="special">()</span></code>. In fact, depending
+ on the context where they are used, types wrapped within parenthesis can
+ generate compiler-time syntactic errors.
+ </p>
+<p>
+ In order to wrap the type expression within parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ that can be parsed correctly by the preprocessor and interpreted correctly
+ the compiler, first we created a void-function type that contains the type
+ expression as the function only argument type:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span><span class="bold"><strong>(</strong></span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span><span class="bold"><strong>)</strong></span> <span class="comment">// Function type (wraps comma within parenthesis).</span>
+</pre>
+<p>
+ Then, we apply the library metafunction <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>wrap</code>
+ that returns the type of the first argument of the specified void-function
+ type:
+ </p>
+<pre class="programlisting"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">wrap</span><span class="special"><</span><span class="keyword">void</span><span class="bold"><strong>(</strong></span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span><span class="bold"><strong>)</strong></span><span class="special">>::</span><span class="identifier">type</span> <span class="comment">// Evaluates to the type `std::map<K, T>`.</span>
+</pre>
+<p>
+ For convenience, the library provides the macro <code class="computeroutput">CONTRACT_WRAP_TYPE<span class="special">()</span></code> which expands to the code above:
+ </p>
+<pre class="programlisting"><span class="identifier">CONTRACT_WRAP_TYPE</span><span class="special">(</span> <span class="bold"><strong>(</strong></span><span class="identifier">std</span><span class="special">::</span><span class="identifier">macp</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span><span class="bold"><strong>)</strong></span> <span class="special">)</span>
+</pre>
+<p>
+ Note the extra parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ similar to what it was used for value expression.
+ </p>
+<a name="contract__.tutorial.commas_within_macro_parameters.body_code_block"></a><h6>
+<a name="contract__.tutorial.commas_within_macro_parameters.body_code_block-heading"></a>
+ <a class="link" href="tutorial.html#contract__.tutorial.commas_within_macro_parameters.body_code_block">Body
+ Code Block</a>
+ </h6>
+<p>
+ Finally, both techniques are applied to eventual commas within code blocks
+ depending if the code is a value or type expression.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ However, if the body definition is separated from the contract declaration
+ then the body code does not appear within a macro parameter so there is
+ no need to implement these workarounds in the body code.
+ </p></td></tr>
+</table></div>
+<p>
+ Applying these techniques to the example above, we obtain the following code
+ which compiles:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="special">(</span><span class="keyword">template</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">typename</span><span class="special">)(</span><span class="identifier">K</span><span class="special">)</span> <span class="special">(</span><span class="keyword">typename</span><span class="special">)(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">)</span>
+<span class="comment">// Commas within type expression using `IDENTITY_TYPE` macro.</span>
+<span class="special">(</span><span class="keyword">typename</span> <span class="identifier">CONTRACT_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>)))</span> <span class="special">(</span><span class="identifier">set</span><span class="special">)(</span>
+ <span class="comment">// Or directly using the `identity_type` metafunction.</span>
+ <span class="special">(</span><span class="keyword">typename</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">identity_type</span><span class="special"><</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>&)</span> <span class="special">>::</span><span class="identifier">type</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">source</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">K</span><span class="special">&)(</span><span class="identifier">key</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)(</span><span class="identifier">element</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span> <span class="special">(</span>
+ <span class="comment">// Commas within value expressions must be wrapped by `()` using</span>
+ <span class="comment">// `bool()` (or `contract::identity()`).</span>
+ <span class="special">(</span><span class="keyword">bool</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">()))</span>
+ <span class="special">)</span>
+<span class="special">({</span>
+ <span class="comment">// Commas within code blocks use same workarounds as above</span>
+ <span class="comment">// wrapping differently commas within type or value expressions. </span>
+ <span class="comment">// Or better, separate body definition so it is outside the macro.</span>
+
+ <span class="comment">// OK, commas already wrapped by function call `()`.</span>
+ <span class="identifier">print</span><span class="special">(</span><span class="identifier">key</span><span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+
+ <span class="comment">// Commas within type expression wrapped using the macro.</span>
+ <span class="keyword">typename</span> <span class="identifier">CONTRACT_IDENTITY_TYPE</span><span class="special">((</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>))</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">source</span><span class="special">;</span>
+
+ <span class="comment">// OK, commas already wrapped by if-statement `()`.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="number">0</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special"><</span><span class="identifier">K</span><span class="special">,</span> <span class="identifier">T</span><span class="special">>().</span><span class="identifier">empty</span><span class="special">())</span> <span class="identifier">m</span><span class="special">[</span><span class="identifier">key</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">element</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="identifier">m</span><span class="special">;</span>
+<span class="special">})</span> <span class="special">)</span>
+
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.tutorial.a_fully_working_example"></a><a class="link" href="tutorial.html#contract__.tutorial.a_fully_working_example" title="A Fully Working Example">A Fully
+ Working Example</a>
+</h3></div></div></div>
+<p>
+ We conclude this section with a fully working example that can be compiled.
+ This example illustrates how to use the library contract macros to program
+ contracts in all the different library usages scenarios (constructor, destructors,
+ member functions, non-member functions, template functions, etc).
+ </p>
+<p>
+ For simplicity, this example only exposes a limited subset of the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
+ operations and it only programs simple contracts for them (see the STL Vector
+ <a class="link" href="examples.html" title="Examples">Example</a> for complete contracts
+ of all <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code> operations). Furthermore, the somewhat
+ artificial base classes have been deliberately introduced to illustrate subcontracting
+ and they will probably not be part of real code.
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Contract++ Syntax (supported for ISO C++ standard)
+ </p>
+ </th>
+<th>
+ <p>
+ N-Paper Proposal Syntax (not part of any C++ standard)
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="string">"pushable.hpp"</span> <span class="comment">// Base classes for subcontracting.</span>
+<span class="preprocessor">#include</span> <span class="string">"boundable.hpp"</span>
+<span class="preprocessor">#include</span> <span class="string">"basic_begin.hpp"</span>
+<span class="preprocessor">#include</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="comment">// This library.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// For static assertion condition.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">concept_check</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Concepts for `(requires)`.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">parameter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Named parameters `(in)/(inout)/(out)`.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">utility</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// For `boost::prior()`.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mpl</span><span class="special">/</span><span class="keyword">bool</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// For static assertion `true_`.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span> <span class="comment">// STL vector.</span>
+
+<span class="comment">// Use importance ordering to specify assertion computational complexity.</span>
+<span class="preprocessor">#define</span> <span class="identifier">O_1</span> <span class="number">0</span> <span class="comment">// Constant O(1) (default importance ordering).</span>
+<span class="preprocessor">#define</span> <span class="identifier">O_LOGN</span> <span class="number">1</span> <span class="comment">// Logaritmic O(log n).</span>
+<span class="preprocessor">#define</span> <span class="identifier">O_N</span> <span class="number">2</span> <span class="comment">// Linear O(n).</span>
+
+<span class="comment">// Wrapper that adds simple (not complete) contracts to C++ STL illustrating</span>
+<span class="comment">// most library usages. For simplicity, assume T is comparable and copyable.</span>
+<span class="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span>
+ <span class="identifier">extends</span><span class="special">(</span> <span class="comment">// Subcontract from base classes (support multiple inheritance).</span>
+ <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span>
+ <span class="keyword">public</span> <span class="identifier">boundable</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">>,</span>
+ <span class="keyword">private</span> <span class="identifier">basic_begin</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
+ <span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Class invariants (checked by any function with a contract).</span>
+ <span class="identifier">CONTRACT_CLASS_INVARIANT</span><span class="special">(</span> <span class="comment">// Optional and they can access object.</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">),</span>
+ <span class="keyword">static</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">></span> <span class="number">0</span> <span class="comment">// Also static assertions.</span>
+ <span class="comment">// More class invariants here...</span>
+ <span class="special">)</span>
+
+ <span class="comment">// Static class invariants (checked by any function with a contract).</span>
+ <span class="identifier">CONTRACT_STATIC_CLASS_INVARIANT</span><span class="special">(</span> <span class="comment">// Optional and cannot access the object.</span>
+ <span class="keyword">true</span>
+ <span class="comment">// More static class invaraints here...</span>
+ <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+ <span class="comment">// Contract for constructor plus default parameter values.</span>
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">explicit</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">default</span> <span class="number">0</span> <span class="special">)</span>
+ <span class="identifier">initialize</span><span class="special">(</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span> <span class="special">)</span> <span class="comment">// Member initializers.</span>
+ <span class="comment">// Never object `this` in constructor preconditions.</span>
+ <span class="comment">// Never `CONTRACT_OLDOF(this)` in constructor postconditions.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Do nothing in this example.</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Contractor for overloaded member (resolved by argumnet name).</span>
+ <span class="identifier">CONTRACT_CONSTRUCTOR</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&)</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">vector_</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">;</span> <span class="comment">// The `;` deferres body definition.</span>
+
+ <span class="comment">// Contract for destructor.</span>
+ <span class="identifier">CONTRACT_DESTRUCTOR</span><span class="special">(</span>
+ <span class="comment">// No `~` in destructor name.</span>
+ <span class="comment">// Use `(void)` for empty function paramters.</span>
+ <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)()</span>
+ <span class="comment">// No preconditions allowed (no arguments).</span>
+ <span class="comment">// No postconditions allowed (no object after destructor).</span>
+ <span class="special">)</span> <span class="special">;</span>
+
+ <span class="comment">// Contract for member function, plus old values, plus assertion importance.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">insert</span><span class="special">)(</span> <span class="comment">// Multiple function parameters.</span>
+ <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">where</span><span class="special">,</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">count</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="comment">// Function preconditions (optional).</span>
+ <span class="identifier">max_size</span><span class="special">()</span> <span class="special">>=</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">count</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">)</span>
+ <span class="comment">// Function postconditions (optional). Old value expressions must have</span>
+ <span class="comment">// different stringetized lengths.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_capacity</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()),</span> <span class="comment">// Use Boost.Typeof.</span>
+ <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="identifier">old_where</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">where</span><span class="special">),</span> <span class="comment">// No Typeof.</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">capacity</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_capacity</span><span class="special">)</span> <span class="special">(</span>
+ <span class="comment">// Importance ordering specify assertion has linear complexity.</span>
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">old_where</span><span class="special">),</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">old_where</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">element</span><span class="special">),</span>
+ <span class="identifier">importance</span> <span class="identifier">O_N</span>
+ <span class="special">)</span> <span class="comment">// Optional `(else ...)` allowed here.</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span> <span class="comment">// Original function implementation.</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">where</span><span class="special">,</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Contract for constant member.</span>
+ <span class="comment">// Non-void result type.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span> <span class="keyword">const</span> <span class="comment">// Constant.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="comment">// Return value named `result`.</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Contract for overloaded member (resolved because not const).</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">iter</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="comment">// Return value namded `iter`.</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">(</span> <span class="identifier">iter</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">;</span>
+
+ <span class="comment">// Contract for operator, plus static assertion.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="comment">// Must spell operator name also in words (e.g., `at`).</span>
+ <span class="keyword">public</span> <span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="keyword">operator</span><span class="special">([],</span> <span class="identifier">at</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="identifier">index</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">(),</span>
+ <span class="comment">// Static assertion (checked at compile-time).</span>
+ <span class="keyword">static</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">has_nothrow_default_constructor</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">;</span>
+
+ <span class="comment">// Main function example used in documentation.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="keyword">static</span> <span class="keyword">false</span><span class="special">,</span> <span class="comment">// Static assertion checked at compile-time.</span>
+ <span class="comment">// This precondition has no effect because subcontracts from</span>
+ <span class="comment">// `pushable::push_back()` which has no preconditions (this</span>
+ <span class="comment">// might be confusing and it is not allowed by [N1962]).</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">static</span> <span class="keyword">true</span><span class="special">,</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="number">1</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Contract for template, plus static member function, plus concepts.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">Iter</span> <span class="special">)</span> <span class="comment">// Function template.</span>
+ <span class="comment">// Concepts (uses Boost.ConceptCheck).</span>
+ <span class="identifier">requires</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">)</span>
+ <span class="comment">// Static member.</span>
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="special">(</span><span class="identifier">all_equals</span><span class="special">)(</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">first</span><span class="special">,</span> <span class="special">(</span><span class="identifier">Iter</span><span class="special">)</span> <span class="identifier">last</span><span class="special">,</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span> <span class="identifier">first</span> <span class="special"><</span> <span class="identifier">last</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Loop variants with importance.</span>
+ <span class="comment">/** @todo Do I need to specify importance for CONTRACT_LOOP so I can
+ * not declare the variant variable to avoid the unused error? But
+ * there should be another way to get rid of the unused error... maybe
+ * use a special object (like for scoped_mutex that do not give the
+ * unused error...). */</span>
+ <span class="identifier">CONTRACT_LOOP</span><span class="special">(</span> <span class="keyword">for</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_LOOP_VARIANT</span><span class="special">(</span> <span class="keyword">const</span><span class="special">(</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">i</span> <span class="special">)</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">last</span><span class="special">,</span> <span class="identifier">i</span><span class="special">),</span>
+ <span class="identifier">importance</span> <span class="identifier">O_N</span> <span class="special">)</span>
+
+ <span class="keyword">if</span><span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">CONTRACT_LOOP_END</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Similarly, complete contracts sketched here and add contracts</span>
+ <span class="comment">// for all other functions (see [Crowl2006] vector example).</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">capacity</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_reference</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// Deferred constructor body definition.</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">CONTRACT_CONSTRUCTOR_BODY</span><span class="special">(</span><span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">myvector</span><span class="special">)(</span> <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span> <span class="special">=</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="comment">// Deferred destructor body definition.</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">CONTRACT_DESTRUCTOR_BODY</span><span class="special">(</span><span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">myvector</span><span class="special">)()</span> <span class="special">{</span>
+ <span class="comment">// Do nothing in this case.</span>
+<span class="special">}</span>
+
+<span class="comment">// Deferred member function definition.</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">CONTRACT_MEMBER_BODY</span><span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+<span class="special">}</span>
+
+<span class="comment">// Deferred member operator definition.</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span>
+ <span class="identifier">CONTRACT_MEMBER_BODY</span><span class="special">(</span><span class="keyword">operator</span><span class="special">([],</span> <span class="identifier">at</span><span class="special">))(</span> <span class="identifier">size_type</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">index</span><span class="special">];</span>
+<span class="special">}</span>
+
+<span class="identifier">BOOST_PARAMETER_NAME</span><span class="special">(</span><span class="identifier">vector</span><span class="special">)</span> <span class="comment">// Declare Boost.Parameter for `vector`.</span>
+
+<span class="comment">// Contracts for free function plus named parameters (Boost.Parameter).</span>
+<span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+<span class="keyword">double</span> <span class="special">(</span><span class="identifier">abs_total</span><span class="special">)(</span> <span class="identifier">in</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>)</span> <span class="identifier">vector</span> <span class="special">)</span> <span class="comment">// Named input parameter.</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">result</span> <span class="special">=</span> <span class="keyword">return</span><span class="special">,</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="number">0.0</span> <span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">total</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="comment">// Block invariants can appear anywhere in code block.</span>
+ <span class="identifier">CONTRACT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="keyword">const</span><span class="special">(</span> <span class="identifier">total</span> <span class="special">)</span> <span class="identifier">total</span> <span class="special">==</span> <span class="number">0.0</span> <span class="special">)</span>
+ <span class="comment">// Block invariants assertions can be static and can have importance.</span>
+ <span class="identifier">CONTRACT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="keyword">static</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">></span> <span class="number">0</span><span class="special">,</span> <span class="identifier">importance</span> <span class="identifier">O_1</span> <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_LOOP</span><span class="special">(</span> <span class="keyword">for</span><span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Block invariants can assert loop invariants (also w/ importance).</span>
+ <span class="comment">// For simplicity, constant-assertion is not used when assertion is</span>
+ <span class="comment">// clearly a constant-expression (it is programmers' responsibility).</span>
+ <span class="identifier">CONTRACT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">)</span>
+ <span class="comment">// Loop variant (can only appear in loops and cannot be static).</span>
+ <span class="identifier">CONTRACT_LOOP_VARIANT</span><span class="special">(</span> <span class="keyword">const</span><span class="special">(</span> <span class="identifier">vector</span><span class="special">,</span> <span class="identifier">i</span> <span class="special">)</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">i</span> <span class="special">)</span>
+
+ <span class="identifier">total</span> <span class="special">+=</span> <span class="identifier">vector</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="special">}</span> <span class="identifier">CONTRACT_LOOP_END</span>
+
+ <span class="keyword">return</span> <span class="identifier">total</span> <span class="special"><</span> <span class="number">0.0</span> <span class="special">?</span> <span class="special">-</span><span class="identifier">total</span> <span class="special">:</span> <span class="identifier">total</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+<span class="preprocessor">#include</span> <span class="string">"puchable.hpp"</span>
+<span class="preprocessor">#include</span> <span class="string">"boundable.hpp"</span>
+<span class="preprocessor">#include</span> <span class="string">"basic_begin.hpp"</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">concepts</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+
+
+
+
+
+<span class="preprocessor">#define</span> <span class="identifier">O_1</span> <span class="number">0</span>
+<span class="preprocessor">#define</span> <span class="identifier">O_LOGN</span> <span class="number">1</span>
+<span class="preprocessor">#define</span> <span class="identifier">O_N</span> <span class="number">2</span>
+
+
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span>
+ <span class="special">:</span>
+ <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span>
+ <span class="keyword">public</span> <span class="identifier">boundable</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">>,</span>
+ <span class="keyword">private</span> <span class="identifier">basic_begin</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span><span class="special">></span>
+
+<span class="special">{</span>
+
+ <span class="identifier">invariant</span> <span class="special">{</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+ <span class="keyword">static</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span> <span class="special">></span> <span class="number">0</span><span class="special">;</span> <span class="comment">// Static assertions not in [N1962] but in [1866].</span>
+
+ <span class="special">}</span>
+
+
+ <span class="keyword">static</span> <span class="identifier">invariant</span> <span class="special">{</span> <span class="comment">// Static class invariants not in [N1962], etc.</span>
+ <span class="keyword">true</span><span class="special">;</span>
+
+ <span class="special">}</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">explicit</span> <span class="identifier">myvector</span><span class="special">(</span> <span class="identifier">size_type</span> <span class="identifier">count</span> <span class="special">=</span> <span class="number">0</span> <span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span>
+
+
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{</span>
+
+ <span class="special">}</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">myvector</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">vector_</span> <span class="special">==</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span> <span class="special">}</span>
+
+
+
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">myvector</span><span class="special">()</span>
+
+
+ <span class="special">;</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">insert</span><span class="special">(</span>
+ <span class="identifier">iterator</span> <span class="identifier">where</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="identifier">max_size</span><span class="special">()</span> <span class="special">>=</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">);</span>
+
+ <span class="special">}</span>
+
+
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">capactiy</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">capacity</span><span class="special">())</span> <span class="special">{</span>
+
+ <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">oldof</span> <span class="identifier">where</span><span class="special">),</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">prior</span><span class="special">(</span><span class="identifier">oldof</span> <span class="identifier">where</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="special">:</span> <span class="identifier">O_N</span><span class="special">;</span> <span class="comment">// Importance ordering from [N1866].</span>
+ <span class="special">}</span>
+
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">where</span><span class="special">,</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="special">}</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">iterator</span> <span class="identifier">begin</span><span class="special">()</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">iter</span> <span class="special">)</span> <span class="special">{</span>
+
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">empty</span><span class="special">())</span> <span class="special">{</span> <span class="identifier">iter</span> <span class="special">==</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="special">;</span>
+
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span> <span class="identifier">size_type</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="identifier">index</span> <span class="special"><</span> <span class="identifier">size</span><span class="special">();</span>
+
+ <span class="keyword">static</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">has_nothrow_default_constructor</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">value</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">;</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="keyword">static</span> <span class="keyword">false</span><span class="special">;</span>
+
+
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">();</span>
+ <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+ <span class="keyword">static</span> <span class="keyword">true</span><span class="special">;</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">Iter</span> <span class="special">></span>
+
+ <span class="identifier">requires</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">InputIterator</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">EqualityComparable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
+
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">all_equals</span><span class="special">(</span> <span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span> <span class="identifier">first</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">{</span>
+
+
+
+
+
+ <span class="comment">// No loop invariant/variant in [N1963].</span>
+ <span class="keyword">for</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+
+
+
+ <span class="keyword">if</span><span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+
+
+
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">capacity</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">capacity</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_reference</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">myvector</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">&</span> <span class="identifier">right</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span> <span class="special">=</span> <span class="identifier">right</span><span class="special">.</span><span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">}</span>
+
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::~</span><span class="identifier">myvector</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> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+<span class="special">}</span>
+
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span>
+ <span class="keyword">operator</span><span class="special">[](</span> <span class="identifier">size_type</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">index</span><span class="special">];</span>
+<span class="special">}</span>
+
+
+
+
+<span class="comment">// No named parameter (there is no C++ proposal that supports them).</span>
+<span class="keyword">double</span> <span class="identifier">abs_total</span><span class="special">(</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span> <span class="special">)</span>
+ <span class="identifier">poscondition</span><span class="special">(</span> <span class="identifier">result</span> <span class="special">)</span> <span class="special">{</span> <span class="identifier">result</span> <span class="special">>=</span> <span class="number">0.0</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">total</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+
+ <span class="identifier">invariant</span> <span class="special">{</span> <span class="identifier">total</span> <span class="special">==</span> <span class="number">0.0</span><span class="special">;</span> <span class="special">}</span>
+
+ <span class="identifier">invariant</span> <span class="special">{</span> <span class="keyword">static</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="keyword">double</span><span class="special">)</span> <span class="special">></span> <span class="number">0</span> <span class="special">:</span> <span class="identifier">O_1</span> <span class="special">}</span> <span class="comment">// No proposal for `static`.</span>
+
+ <span class="keyword">for</span><span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+
+
+
+ <span class="identifier">invariant</span> <span class="special">{</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+
+ <span class="comment">// No proposal for loop variants.</span>
+
+ <span class="identifier">total</span> <span class="special">+=</span> <span class="identifier">vector</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="special">}</span>
+
+ <span class="keyword">return</span> <span class="identifier">total</span> <span class="special"><</span> <span class="number">0.0</span> <span class="special">?</span> <span class="special">-</span><span class="identifier">total</span> <span class="special">:</span> <span class="identifier">total</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</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="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">pushable</span><span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// No class invariants.</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">pushable</span><span class="special">()</span> <span class="special">{}</span>
+
+ <span class="comment">// Contract for pure virtual function.</span>
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="comment">/** @todo No precondition here implies all preconditions of derived
+ * classes have no effect... */</span>
+ <span class="identifier">postcondition</span><span class="special">(</span> <span class="identifier">back</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="special">)</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="comment">// Pure virtual body.</span>
+
+ <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">pushable</span>
+<span class="special">{</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">pushable</span><span class="special">()</span> <span class="special">{}</span>
+
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span> <span class="special">)</span>
+
+
+ <span class="identifier">postcondition</span> <span class="special">{</span> <span class="identifier">back</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">element</span><span class="special">;</span> <span class="special">}</span>
+ <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+
+ <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</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="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">ConstIter</span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">boundable</span><span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_CLASS_INVARIANT</span><span class="special">(</span> <span class="identifier">begin</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">end</span><span class="special">()</span> <span class="special">)</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">boundable</span><span class="special">()</span> <span class="special">{}</span>
+
+ <span class="keyword">virtual</span> <span class="identifier">ConstIter</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="keyword">virtual</span> <span class="identifier">ConstIter</span> <span class="identifier">end</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">ConstIter</span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">boundable</span>
+<span class="special">{</span>
+ <span class="identifier">invariant</span> <span class="special">{</span> <span class="identifier">begin</span><span class="special">()</span> <span class="special"><=</span> <span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">boundable</span><span class="special">()</span> <span class="special">{}</span>
+
+ <span class="keyword">virtual</span> <span class="identifier">ConstIter</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="keyword">virtual</span> <span class="identifier">ConstIter</span> <span class="identifier">end</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</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="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">class</span> <span class="identifier">ConstIter</span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">basic_begin</span><span class="special">)</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// No class invariants.</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">basic_begin</span><span class="special">()</span> <span class="special">{}</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="special">(</span><span class="identifier">ConstIter</span><span class="special">)</span> <span class="special">(</span><span class="identifier">begin</span><span class="special">)()</span> <span class="keyword">const</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">ConstIter</span><span class="special">();</span> <span class="comment">// Dummy implementation (for example only).</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">class</span> <span class="identifier">ConstIter</span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">basic_begin</span>
+<span class="special">{</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">basic_begin</span><span class="special">()</span> <span class="special">{}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">virtual</span> <span class="identifier">ConstIter</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">ConstIter</span><span class="special">();</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id866548" href="#id866548" class="para">2</a>] </sup>
+ Static member functions cannot be virtual so they cannot be overridden
+ and they cannot subcontract.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id866910" href="#id866910" class="para">3</a>] </sup>
+ However, the destructor body should be programmed to <span class="emphasis"><em>never</em></span>
+ throw exceptions to comply with C++ STL exception safety requirements.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id867338" href="#id867338" class="para">4</a>] </sup>
+ As usual in C++, constant-correctness can be enforced at compile-time only
+ as long as programmers do not use <code class="computeroutput"><span class="keyword">const_cast</span></code>
+ and <code class="computeroutput"><span class="keyword">mutable</span></code>.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id867464" href="#id867464" class="para">5</a>] </sup>
+ To improve contract readability, it is recommended to configure your editor
+ C++ syntax highlighting to highlight also the macros <code class="computeroutput"><span class="identifier">CONTRACT_INVARIANT</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_FUNCTION</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_CONSTRUCTOR</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_DESTRUCTOR</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_OLDOF</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_BODY</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_CONSTRUCTOR_BODY</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_DESTRUCTOR_BODY</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_MSG</span></code>, <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT_MSG</span></code>,
+ <code class="computeroutput"><span class="identifier">CONTRACT_INIT_LOOP_VARIANT</span></code>,
+ and the sequence tokens <code class="computeroutput"><span class="identifier">precondition</span></code>,
+ <code class="computeroutput"><span class="identifier">postcondition</span></code>, <code class="computeroutput"><span class="identifier">body</span></code>, <code class="computeroutput"><span class="identifier">copyable</span></code>,
+ and <code class="computeroutput"><span class="identifier">inherit</span></code>. For example,
+ this can be done in the Vi IMproved (VIM) editor by adding these symbols
+ to the <code class="computeroutput"><span class="string">"cpp.vim"</span></code>
+ file (usually in the VIM system configuration directory).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id867784" href="#id867784" class="para">6</a>] </sup>
+ Some text editing programs might highlight curly brackets <code class="computeroutput"><span class="special">{}</span></code> within a macro parameter as a C++
+ syntax error. This is incorrect as the ISO C++ standard allows for
+ macro parameters to contain curly brackets and the editor might offer
+ an option for disabling this incorrect syntax error highlighting. For
+ example, when C++ syntax highlighting is turned on in the Vi IMproved
+ (VIM) editor, curly brackets within macro parameters are highlighted
+ as errors but that can be disabled by adding the line <code class="computeroutput"><span class="identifier">let</span> <span class="identifier">c_no_curly_error</span><span class="special">=</span><span class="number">1</span></code> in
+ the <code class="computeroutput"><span class="string">".vimrc"</span></code>
+ file (typically in your home directory).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id868670" href="#id868670" class="para">7</a>] </sup>
+ However, this is the only sensible semantics for copying pointers as
+ the pointer could of type <code class="computeroutput"><span class="keyword">void</span><span class="special">*</span></code> for which it is not possible to copy
+ the pointed object, plus there might cases where the functions actually
+ changed the pointer value so <code class="computeroutput">CONTRACT_OLDOF<span class="special">()</span></code> needs to the return the old pointer
+ value (and not the old pointed value), plus this the usual C++ pointer
+ copy semantic.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id871438" href="#id871438" class="para">8</a>] </sup>
+ <a class="link" href="bibliography.html" title="Bibliography">[Meyer1997]</a> argues preconditions
+ asserted using non-public members are ill written thus the Eiffel programming
+ language enforces this rule at compile-time. However, in C++ friend callers
+ could still be able to fully check preconditions via the friendship even
+ when non-public functions are used to assert them therefore this rule is
+ left as a recommended practice for programmers to follow and it is not
+ enforced by the library.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id871584" href="#id871584" class="para">9</a>] </sup>
+ If two Boost.Preprocessor
+ sequences are specified one after the other then they are automatically
+ concatenated into one larger sequence. For example let <code class="computeroutput"><span class="identifier">seq1</span></code>
+ be <code class="computeroutput"><span class="special">(</span><span class="identifier">token1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token2</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">seq2</span></code>
+ be <code class="computeroutput"><span class="special">(</span><span class="identifier">token3</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token4</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token5</span><span class="special">)</span></code> then <code class="computeroutput"><span class="identifier">seq1</span>
+ <span class="identifier">seq2</span></code> is <code class="computeroutput"><span class="special">(</span><span class="identifier">token1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token2</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token3</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token4</span><span class="special">)</span> <span class="special">(</span><span class="identifier">token5</span><span class="special">)</span></code>.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id871800" href="#id871800" class="para">10</a>] </sup>
+ Because the <span class="emphasis"><em>signature-sequence</em></span> essentially contains
+ all the tokens necessary to declare the function, the contract macros could
+ have been implemented to replace the function declaration entirely instead
+ of being specified right after the function declaration. This would have
+ saved the programmers from repeating the function declaration tokens twice,
+ first to declare the function and then to invoke the contract macro. However,
+ replacing the function declarations entirely with the unfamiliar looking
+ <span class="emphasis"><em>signature-sequence</em></span> would have drastically reduced
+ readability therefore it was intentionally avoided.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id873455" href="#id873455" class="para">11</a>] </sup>
+ A <span class="emphasis"><em>constant-correct copy constructor</em></span> constructs
+ the object copying it from a constant-reference of the source object
+ thus it cannot alter the state of the copied object.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id875102" href="#id875102" class="para">12</a>] </sup>
+ However, this could change in future revisions of the library if C++ were
+ to support delegating constructors (see <a class="link" href="bibliography.html" title="Bibliography">[Sutter2005]</a>).
+ Therefore, <code class="computeroutput"><span class="special">(</span><span class="keyword">explicit</span><span class="special">)</span></code> is part of the library API and it should
+ always be specified in <span class="emphasis"><em>signature-sequence</em></span> when the
+ contracted constructor is <code class="computeroutput"><span class="keyword">explicit</span></code>.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id875716" href="#id875716" class="para">13</a>] </sup>
+ One specific token ordering was fixed so to simplify the implementation
+ of the library code that parsers <span class="emphasis"><em>signature-sequence</em></span>.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id878216" href="#id878216" class="para">14</a>] </sup>
+ Using the augmented object state the library could detect infinite recursion
+ between overriding and overridden function. However, to break the recursion
+ the base contract will have to call the base body function forcing static
+ binding (otherwise using dynamic binding the overriding function will be
+ called causing the infinite recursion). The contract itself cannot perform
+ the static binding call (e.g., using static_cast<> to the object)
+ because the object state is changed only if pointers or references to the
+ objects are used to call the body, but if pointers or reference are used
+ then C++ uses dynamic binding for the call. So the contract function could
+ call a special method of the contract class which performs the static binding
+ call but such a static binding call will raise a compiler error if the
+ body function is pure virtual. The library does not know directly when
+ a function is pure virtual (body is <code class="computeroutput"><span class="special">=</span>
+ <span class="number">0</span><span class="special">;</span></code>)
+ or not so the library will have to define the contract class static binding
+ method also for pure virtual functions and in this case the static binding
+ call <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">f</span><span class="special">()</span></code> will
+ raise a compile time error because the function called via static binding
+ is pure virtual.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id883219" href="#id883219" class="para">15</a>] </sup>
+ The library <span class="emphasis"><em>could</em></span> overcome this limitation if future
+ versions of the C++ standard were to support delegating constructors
+ (as proposed by <a class="link" href="bibliography.html" title="Bibliography">[Sutter2005]</a>).
+ </p></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="without_the_macros.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/contract__/without_the_macros.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,1425 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Without the Macros</title>
+<link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Contract++ 0.3.490">
+<link rel="up" href="../index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="tutorial.html" title="Tutorial">
+<link rel="next" href="examples.html" title="Examples">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.without_the_macros"></a><a class="link" href="without_the_macros.html" title="Without the Macros">Without the Macros</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.an_example__without_the_macros_">An
+ Example (Without the Macros)</a></span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.optional_contract_compilation">Optional
+ Contract Compilation</a></span></dt>
+<dt><span class="section">Assertions</span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.augmented_state">Augmented
+ State</a></span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.class_invariants">Class
+ Invariants</a></span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.contracted_function">Contracted
+ Function</a></span></dt>
+<dt><span class="section">Preconditions</span></dt>
+<dt><span class="section">Postconditions</span></dt>
+<dt><span class="section">Body</span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.contract_class">Contract
+ Class</a></span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.static_member_functions">Static
+ Member Functions</a></span></dt>
+<dt><span class="section">Constructors</span></dt>
+<dt><span class="section">Destructors</span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.non_member_functions">Non-Member
+ Functions</a></span></dt>
+<dt><span class="section"><a href="without_the_macros.html#contract__.without_the_macros.a_fully_working_example__without_the_macros_">A
+ Fully Working Example (Without the Macros)</a></span></dt>
+</dl></div>
+<p>
+ This section explains how to program contracts without using the library macros.
+ This is useful to better understand how the library actually implements Contract
+ Programming and to occasionally implement workarounds for compiler standard
+ compliance issues. However:
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ <span class="bold"><strong>Recommended to Use Contract Macros</strong></span>
+ </p>
+<p>
+ In general, it is recommended to write contracts using the library macros
+ because they save programmers from writing a significant amount of setup
+ code.
+ </p>
+</td></tr>
+</table></div>
+<p>
+ All the macros described in the <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+ section expand to code equivalent to the one explained in this section (with
+ the exception of block invariants and loop variants which are not covered here).
+ See also the Reference section for more
+ details.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.an_example__without_the_macros_"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.an_example__without_the_macros_" title="An Example (Without the Macros)">An
+ Example (Without the Macros)</a>
+</h3></div></div></div>
+<p>
+ The following example shows how to write a contract for the vector <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function without using the contract macros:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="string">"pushable.hpp"</span> <span class="comment">// Base class for subcontracting.</span>
+<span class="preprocessor">#include</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="comment">// This library.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span> <span class="comment">// STL vector.</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="comment">/* Support for */</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="comment">/* optional contract */</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span> <span class="comment">/* compilation. */</span>
+ <span class="comment">// Augmented state.</span>
+ <span class="keyword">friend</span> <span class="keyword">class</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span><span class="special">;</span>
+ <span class="keyword">mutable</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span> <span class="identifier">contract_state_</span><span class="special">;</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span>
+ <span class="comment">// Static class invariants</span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_static_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Assert nothing in this case.</span>
+ <span class="special">}</span>
+ <span class="comment">// Class invariants.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!((</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More invariants here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// invariants</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Contracted function.</span>
+ <span class="special">{</span> <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="keyword">this</span> <span class="special">,</span> <span class="identifier">element</span><span class="special">);</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span> <span class="comment">// Private so not to alter user call public API.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">contract_precondition_push_back_element_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">contract_postcondition_push_back_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">*</span> <span class="identifier">old_this</span><span class="special">,</span> <span class="comment">// Old value for object.</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span> <span class="comment">// No old for `element` argument.</span>
+ <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">old_this</span><span class="special">-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+<span class="keyword">protected</span><span class="special">:</span> <span class="comment">// Must be protected (not private) to allow subcontracting.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_push_back_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+ <span class="comment">// Original function definition (the body).</span>
+ <span class="special">{</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Contract class.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_push_back_element_</span><span class="special">:</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span>
+ <span class="comment">// Function type for contracted function.</span>
+ <span class="comment">// Copyable class type for old object value in postconditions.</span>
+ <span class="comment">// For constant members use `myvector const` instead of `myvector`.</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="comment">// Base contract class for subcontracting.</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span> <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">></span> <span class="special">{</span>
+ <span class="comment">// Constructor specifies body, preconditions, and postconditions.</span>
+ <span class="identifier">contract_push_back_element_</span><span class="special">():</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">static_member_function</span><span class="special"><</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span> <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">>(</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_body_push_back_</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_precondition_push_back_element_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_postcondition_push_back_element_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+ <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span> <span class="comment">// Restore original access level.</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+ <span class="special">...</span> <span class="comment">// Rest of the class.</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Let's take a close look at this code.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.optional_contract_compilation"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.optional_contract_compilation" title="Optional Contract Compilation">Optional
+ Contract Compilation</a>
+</h3></div></div></div>
+<p>
+ First of all, note that when programmers completely disable contract compilation
+ by not #defining any of the <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>,
+ <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>,
+ and <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ macro symbols, the code above reduces to just the function declaration and
+ its definition without <span class="bold"><strong>any</strong></span> contract code
+ overhead:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">{</span>
+
+ <span class="bold"><strong>// Augmented state and class invariants disappear!</strong></span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">value</span><span class="special">)</span>
+ <span class="bold"><strong>// Preconditions, postconditions, and body functions disappear!</strong></span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">value</span><span class="special">);</span> <span class="comment">// Original function implementation.</span>
+ <span class="special">}</span>
+ <span class="bold"><strong>// Contract class disappears!</strong></span>
+<span class="keyword">public</span><span class="special">:</span>
+
+ <span class="special">...</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note how the <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>,
+ <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>,
+ and <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ macros can be #defined independently to selectively turn on or off the compilation
+ of class invariants only, preconditions only, postconditions only, or any
+ combination of the above.
+ </p>
+<p>
+ The rest of this section illustrates what happens when contract compilation
+ is turned on. Therefore, from here on, we will assume that <code class="computeroutput">CONTRACT_CHECK_CLASS_INVARIANT</code>
+ , <code class="computeroutput">CONTRACT_CHECK_PRECONDITION</code>,
+ and <code class="computeroutput">CONTRACT_CHECK_POSTCONDITION</code>
+ are all #defined.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.assertions"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.assertions" title="Assertions">Assertions</a>
+</h3></div></div></div>
+<p>
+ Note how class invariants, preconditions, and postconditions are asserted
+ using an <code class="computeroutput"><span class="keyword">if</span></code>-statement that throws
+ a <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>failure</code> exception in case the
+ checked boolean condition is false (note the leading <code class="computeroutput"><span class="string">"!"</span></code>
+ within the <code class="computeroutput"><span class="keyword">if</span></code>-condition):
+ </p>
+<pre class="programlisting"><span class="comment">// Code from the non-static class invariants (but similar for</span>
+<span class="comment">// static class invariants, preconditions, and postconditions).</span>
+<span class="keyword">if</span> <span class="special">(</span><span class="bold"><strong>!</strong></span><span class="special">((</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+</pre>
+<p>
+ When an exception (<span class="emphasis"><em>any</em></span> exception) is thrown from within
+ class invariants, preconditions, or postconditions code blocks, the library
+ will handle the exception invoking the relative <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>class_invariant_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>precondition_failed<span class="special">()</span></code>, or <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>postcondition_failed<span class="special">()</span></code> function (but only if that is necessary
+ according to subcontracting rules, see below). Therefore, the fact that the
+ contract condition check throws <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>failure</code>
+ does <span class="emphasis"><em>not</em></span> necessarily imply that the program itself will
+ throw but only that the correct contract failure handler function will be
+ invoked by the library. All contract failure handler functions terminate
+ by default but they can be customized (see <a class="link" href="throw_on_failure.html" title="Annex: Throw on Failure">Throw
+ on Failure</a> for an example).
+ </p>
+<p>
+ It is not possible to directly call <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>class_invariant_failed<span class="special">()</span></code>, <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>precondition_failed<span class="special">()</span></code>, or <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>postcondition_failed<span class="special">()</span></code> instead of throwing the exception because
+ of subcontracting. For example, if a precondition of a derived contract fails
+ but the preconditions of an overridden contract hold true then the library
+ will <span class="emphasis"><em>not</em></span> call <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>precondition_failed<span class="special">()</span></code> even if the derived contract throws an
+ exception (as specified by subcontracting requirements in <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.member_function_call_semantics">Member
+ Function Call Semantics</a>).
+ </p>
+<p>
+ The first two arguments of the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>failure</code>
+ constructor are mandatory and they specify file name and line number of the
+ assertion (used the C++ macros <code class="computeroutput"><span class="identifier">__FILE__</span></code>
+ and <code class="computeroutput"><span class="identifier">__LINE__</span></code>). The third
+ argument of the constructor is an optional human readable description of
+ the asserted condition. For example:
+ </p>
+<pre class="programlisting"><span class="comment">// More verbose error message with .</span>
+<span class="keyword">if</span> <span class="special">(!((</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">,</span> <span class="string">"size zero iff empty"</span><span class="special">);</span>
+</pre>
+<p>
+ All this information is simply used to provide the user with a descriptive
+ error message in case of a contract failure, for example:
+ </p>
+<pre class="programlisting">class invariant: terminate called after throwing an instance of 'contract::failure'
+ what(): contract "size zero iff empty" failed at myvector_nomacros.cpp:37
+Aborted
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.augmented_state"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.augmented_state" title="Augmented State">Augmented
+ State</a>
+</h3></div></div></div>
+<p>
+ This library needs to declare an additional member variable for the class.
+ This member variable is mainly used by the library to keep track of when
+ contracts are being checked so to disable assertion checking in nested member
+ function calls that could otherwise result in infinite recursion (this a
+ common requirement in Contract Programming).
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+ <span class="comment">// Augmented state.</span>
+ <span class="keyword">friend</span> <span class="keyword">class</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span><span class="special">;</span>
+ <span class="keyword">mutable</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span> <span class="identifier">contract_state_</span><span class="special">;</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The state member variable must be declared of <code class="computeroutput"><span class="keyword">mutable</span></code>
+ type <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>state</code> (so the library can modify
+ it while still ensuring constant-correctness for the contracts), it should
+ be in a private section of the class (so not to alter the class public API),
+ and it must have the predefined name <code class="computeroutput">contract_state_</code>
+ (so the library knows how to access it). Furthermore, the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>state</code>
+ class type must be declared a friend so the library can internally access
+ the entire user class including its private and protected members.
+ </p>
+<p>
+ The details of the <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>state</code>
+ type are library implementation specific. The state variable name begins
+ with the <code class="computeroutput"><span class="identifier">contract</span></code> prefix
+ and ends with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so programmers should never directly use it in user code (see <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.class_invariants"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.class_invariants" title="Class Invariants">Class
+ Invariants</a>
+</h3></div></div></div>
+<p>
+ This library checks static and non-static class invariants invoking a static
+ and a constant member function with the predefined names <code class="computeroutput">contract_static_invariant_</code>
+ and <code class="computeroutput"><span class="identifier">__contract_invariant__</span></code>
+ respectively:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+ <span class="comment">// Static class invariants</span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_static_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Assert nothing in this case.</span>
+ <span class="special">}</span>
+ <span class="comment">// Class invariants.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!((</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More invariants here...</span>
+ <span class="special">}</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The non-static class invariant function must a constant member so to enforce
+ contract checking constant-correctness. The static class invariants function
+ is static so it cannot change the object state because it cannot access the
+ object (static member functions cannot be constant).
+ </p>
+<p>
+ The class invariant function names begin with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and end with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so programmers should never directly use it in user code (see <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.contracted_function"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.contracted_function" title="Contracted Function">Contracted
+ Function</a>
+</h3></div></div></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function is programmed to construct the <code class="computeroutput"><span class="identifier">contract</span></code>
+ object and to invoke its <code class="computeroutput">call<span class="special">()</span></code> member function:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="comment">// Contracted function.</span>
+ <span class="special">{</span>
+ <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="keyword">this</span> <span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The <code class="computeroutput">call<span class="special">()</span></code> function takes in input a pointer to the
+ object (<code class="computeroutput"><span class="keyword">this</span></code>) and the function
+ arguments (just <code class="computeroutput"><span class="identifier">element</span></code> in
+ this example) in the order they appear in the function declaration.
+ </p>
+<p>
+ The <code class="computeroutput">call<span class="special">()</span></code> function is the one implementing the correct
+ Contract Programming call semantics (see <a class="link" href="tutorial.html#contract__.tutorial.contract_programming_overview.member_function_call_semantics">Member
+ Function Call Semantics</a>). In this case, <code class="computeroutput">call<span class="special">()</span></code> checks class invariants and preconditions
+ (calling <code class="computeroutput">contract_static_invariant_<span class="special">()</span></code>, <code class="computeroutput">contract_invariant_<span class="special">()</span></code>, and the precondition
+ function, see below), then it executes the body, and lastly it checks class
+ invariants and postconditions (calling <code class="computeroutput">contract_static_invariant_<span class="special">()</span></code>, <code class="computeroutput">contract_invariant_<span class="special">()</span></code>, and the postcondition
+ function, see below).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.preconditions"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.preconditions" title="Preconditions">Preconditions</a>
+</h3></div></div></div>
+<p>
+ A member function is defined to check the preconditions:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">contract_precondition_push_back_element_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">}</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note the followings:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The precondition function is private so not to alter the user class public
+ API.
+ </li>
+<li class="listitem">
+ In order to support contracts for overloaded functions, the precondition
+ function name must contain the contracted function name, the name of
+ all arguments, and the trailing cv-qualifier if the contracted function
+ is cv-qualified (similarly to the contract class name, see below).
+ </li>
+<li class="listitem">
+ The precondition function must be a constant member plus all its arguments
+ must be constant so to enforce contract constant-correctness.
+ </li>
+<li class="listitem">
+ The precondition function must be <code class="computeroutput"><span class="keyword">volatile</span></code>
+ if the contracted function is <code class="computeroutput"><span class="keyword">volatile</span></code>.
+ </li>
+<li class="listitem">
+ The precondition function arguments are constant references to the contracted
+ function arguments.
+ </li>
+</ul></div>
+<p>
+ The precondition function name begins with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and ends with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so programmers should never directly use it in user code (see <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.postconditions"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.postconditions" title="Postconditions">Postconditions</a>
+</h3></div></div></div>
+<p>
+ A member function is defined to check the postconditions:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="special">...</span> <span class="comment">// Preconditions.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_postcondition_push_back_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">*</span> <span class="identifier">old_this</span><span class="special">,</span> <span class="comment">// Old value for object.</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span> <span class="comment">// No old for `element` argument.</span>
+ <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">old_this</span><span class="special">-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">}</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note the followings:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The postcondition function is private so not to alter the user class
+ public API.
+ </li>
+<li class="listitem">
+ In order to support contracts for overloaded functions, the postcondition
+ function name must contain the contracted function name, the name of
+ all arguments, and the trailing cv-qualifier if the contracted function
+ is cv-qualified (similarly to the contract class name, see below).
+ </li>
+<li class="listitem">
+ The postcondition function must be a constant member plus all its arguments
+ must be constant so to enforce contract constant-correctness.
+ </li>
+<li class="listitem">
+ The precondition function must be <code class="computeroutput"><span class="keyword">volatile</span></code>
+ if the contracted function is <code class="computeroutput"><span class="keyword">volatile</span></code>.
+ </li>
+<li class="listitem">
+ The first postcondition function argument is a constant pointer to the
+ object old value when the class type is tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ within the contract class (see below), otherwise it is of type <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code>.
+ </li>
+<li class="listitem">
+ The remaining postcondition function arguments are constant references
+ to the contracted function argument current and old values. A function
+ argument old value is different from <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">nold</span></code>
+ only if the argument type is tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ within the contract class (see below).
+ </li>
+<li class="listitem">
+ Finally, for non-void contracted functions, there is an extra argument
+ at the very end of the postcondition function argument list which is
+ a constant reference to the function result value being returned.
+ </li>
+</ul></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code> type is used as a "placeholder"
+ for an argument when its old value is <span class="emphasis"><em>not</em></span> provided in
+ the postconditions. An <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code>
+ argument cannot be mistakenly accessed or manipulated by programmers because
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code> is an empty class with no member
+ at all. Furthermore, copying <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code>
+ performs no operation so <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span></code>
+ arguments can be passed to the postcondition function by value but without
+ adding any run-time overhead. This ensures that programmers can only access
+ old values in postconditions for types that are tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>.
+ </p>
+<p>
+ This is an example where the old value is provided for both the object and
+ one of the function arguments:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">iterator</span> <span class="identifier">insert</span><span class="special">(</span><span class="identifier">iterator</span> <span class="identifier">where</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="special">...</span>
+ <span class="keyword">void</span> <span class="identifier">contract_postcondition_insert_insert_where_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">*</span> <span class="identifier">old_this</span><span class="special">,</span> <span class="comment">// Old value for object.</span>
+ <span class="keyword">const</span> <span class="identifier">iterator</span><span class="special">&</span> <span class="identifier">where</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">iterator</span><span class="special">&</span> <span class="identifier">old_where</span><span class="special">,</span> <span class="comment">// Old value for `where`.</span>
+
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span> <span class="comment">// No old for `element` argument.</span>
+ <span class="keyword">const</span> <span class="identifier">iterator</span><span class="special">&</span> <span class="identifier">result</span> <span class="comment">// Result value.</span>
+ <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Assert postconditions using `old_this` and `old_where`.</span>
+ <span class="special">}</span>
+ <span class="special">...</span> <span class="comment">// Both class type and `where` type are tagged `contract::copyable`.</span>
+ <span class="comment">// in the contract class (see below).</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The postcondition function name begins with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and ends with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so programmers should never directly use it in user code (see <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.body"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.body" title="Body">Body</a>
+</h3></div></div></div>
+<p>
+ A member function is declared as the body function and it is defined to be
+ the original function implementation as specified by the user:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_push_back_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="comment">// Original function definition (the body).</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note the followings:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The body function is protected to avoid changing the user's class public
+ API but it cannot be private to allow for subcontracting of pure virtual
+ functions.
+ </li>
+<li class="listitem">
+ The body function declaration and definition must be <span class="emphasis"><em>exactly</em></span>
+ the ones specified by the user for the original <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> function (only the function name is
+ different). For example, if the original function is declared <code class="computeroutput"><span class="keyword">virtual</span></code>, the body function should be declared
+ <code class="computeroutput"><span class="keyword">virtual</span></code> as well. Also the
+ body function signature (return type, argument type, argument names,
+ eventual cv-qualifier, etc) must match exactly the signature of the original
+ <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function.
+ </li>
+</ul></div>
+<p>
+ The body function name begins with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and ends with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ so programmers should never directly use it in user code (see <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>).
+ </p>
+<a name="contract__.without_the_macros.body.separating_the_definition"></a><h6>
+<a name="contract__.without_the_macros.body.separating_the_definition-heading"></a>
+ <a class="link" href="without_the_macros.html#contract__.without_the_macros.body.separating_the_definition">Separating
+ the Definition</a>
+ </h6>
+<p>
+ In this example, the body function definition <code class="computeroutput"><span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="special">}</span></code> is specified together with the body function
+ declaration. However, following C++ usual syntax, programmers can define
+ the body function to be "<code class="computeroutput"><span class="special">;</span></code>"
+ in order to separate the function definition from its declaration:
+ </p>
+<pre class="programlisting"><span class="comment">// Declarations (usually in header files).</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_push_back_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="bold"><strong>;</strong></span> <span class="comment">// Separating body definition using `;`.</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+
+<span class="comment">// Separated definitions (eventually in a different file).</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="bold"><strong>contract_body_push_back_</strong></span> <span class="comment">// Body function name.</span>
+<span class="preprocessor">#else</span>
+ <span class="bold"><strong>push_back</strong></span> <span class="comment">// Actual function name if contract compilation is off.</span>
+<span class="preprocessor">#endif</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="comment">// Original function definition.</span>
+<span class="special">}</span>
+</pre>
+<p>
+ In this case, it is recommended to used the <code class="computeroutput">CONTRACT_BODY<span class="special">()</span></code> macro instead of the hard to read <code class="computeroutput"><span class="preprocessor">#if</span></code> around the function name. If contract
+ compilation is on, <code class="computeroutput">CONTRACT_BODY<span class="special">(</span><span class="identifier">push_back</span><span class="special">)</span></code> expands to <code class="computeroutput"><span class="identifier">contract_body_push_back_</span></code>,
+ otherwise it expands to <code class="computeroutput"><span class="identifier">push_back</span></code>
+ (see Reference and <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+ sections). Using this macro, the above function definition is equivalently
+ written as:
+ </p>
+<pre class="programlisting"><span class="comment">// Separated definitions (eventually in a different file).</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">myvector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="bold"><strong>CONTRACT_FUNCTION_BODY(push_back)</strong></span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="comment">// Original function definition.</span>
+<span class="special">}</span>
+</pre>
+<a name="contract__.without_the_macros.body.pure_virtual_functions"></a><h6>
+<a name="contract__.without_the_macros.body.pure_virtual_functions-heading"></a>
+ <a class="link" href="without_the_macros.html#contract__.without_the_macros.body.pure_virtual_functions">Pure
+ Virtual Functions</a>
+ </h6>
+<p>
+ Programmers can also define the body function to be pure virtual so to defer
+ its definition to derived classes. In this case the usual C++ syntax "<code class="computeroutput">
+ <span class="special">=</span> <span class="number">0</span><span class="special">;</span></code>" is used:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">pushable</span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_push_back_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="bold"><strong>= 0;</strong></span> <span class="comment">// Contract for pure virtual functions.</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.contract_class"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.contract_class" title="Contract Class">Contract
+ Class</a>
+</h3></div></div></div>
+<p>
+ A member class is defined as the contract class:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+ <span class="special">...</span>
+
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="special">...</span>
+ <span class="comment">// Contract class.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_push_back_element_</span><span class="special">:</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span>
+ <span class="comment">// Function type for contracted function.</span>
+ <span class="comment">// Copyable class type for old object value in postconditions.</span>
+ <span class="comment">// For const members, use `myvector const` instead of `myvector`.</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="comment">// Base contract class for subcontracting.</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span> <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">></span> <span class="special">{</span>
+ <span class="comment">// Constructor specifies body, preconditions, and postconditions.</span>
+ <span class="identifier">contract_push_back_element_</span><span class="special">():</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span> <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">>(</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_body_push_back_</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_precondition_push_back_element_</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_postcondition_push_back_element_</span>
+ <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span> <span class="comment">// Restore original access level.</span>
+
+ <span class="special">...</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Note the followings:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The contract class is protected to avoid changing the user's class public
+ API but it cannot be private because derived classes might need to access
+ it for subcontracting.
+ </li>
+<li class="listitem">
+ The contract class publicly inherits (it is a <code class="computeroutput"><span class="keyword">struct</span></code>)
+ from <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>.
+ The <code class="computeroutput">call<span class="special">()</span></code> function, which implements the contract
+ call semantics, is inherited from this base class.
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>
+ template takes as first parameter the a function type matching the signature
+ of the contracted <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> function.
+ <div class="itemizedlist"><ul class="itemizedlist" type="circle">
+<li class="listitem">
+ For member functions (including static members, constructors, and
+ destructors, see <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>static_member_function</code>,
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>constructor</code>, and
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>destructor</code> respectively),
+ the first argument of the function type if a pointer to the class
+ type, followed by the contracted function argument types. Instead,
+ for non-member functions (see <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonmember_function</code>),
+ there is no class pointer type and the first argument of the function
+ type matches the first argument type of the contract function.
+ (This is the same syntax used by Boost.Function
+ <sup>[<a name="id913593" href="#ftn.id913593" class="footnote">16</a>]</sup>.)
+ </li>
+<li class="listitem">
+ For cv-qualified member functions, the first argument is specified
+ as a cv-qualified pointer to the class type. For example, if the
+ function in this example were to be a <code class="computeroutput"><span class="keyword">const</span></code>
+ member function <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(...)</span>
+ <span class="keyword">const</span></code> then the function
+ type would have been <code class="computeroutput"><span class="keyword">void</span>
+ <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span>copyable<span class="special"><</span><span class="identifier">myvector</span>
+ <span class="keyword">const</span><span class="special">>*,</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span></code>. Note that when both <code class="computeroutput"><span class="keyword">const</span></code> and <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ are used, <code class="computeroutput"><span class="keyword">const</span></code> must
+ be used within <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ <sup>[<a name="id913920" href="#ftn.id913920" class="footnote">17</a>]</sup>. Similarly, for <code class="computeroutput"><span class="keyword">volatile</span></code>
+ and <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">volatile</span></code>.
+ </li>
+<li class="listitem">
+ In the function type, the class type (which is specified only for
+ member functions) and the argument types can be tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code> if the relative
+ old values are needed in postconditions. Any type tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code> (<code class="computeroutput"><span class="identifier">myvector</span></code> in this example) must
+ have an accessible constant-correct copy constructor otherwise
+ the library will generate a compile-time error (see <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copy</code>). Note that the object
+ <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code> only wraps
+ the class type and not the pointer (i.e., <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable<span class="special"><</span><span class="identifier">myvector</span><span class="special">*></span></code> is invalid) but for all the
+ contracted function argument types <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ wraps the entire type including eventual pointers -- this is because
+ for member functions, the first argument of the function type must
+ always be a pointer to the class type (even when the class type
+ is tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ and/or it is qualified <code class="computeroutput"><span class="keyword">const</span></code>).
+ </li>
+</ul></div>
+ </li>
+<li class="listitem">
+ When subcontracting, the base contract classes are specified as the optional
+ template parameters following the function type for <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>
+ (one base contract is specified in this case <code class="computeroutput"><span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">contract_push_back_element</span><span class="special"><</span><span class="number">0</span><span class="special">></span></code>).
+ All these template parameters are optional and multiple base contract
+ classes can be specified to support subcontracting for multiple inheritance.
+ </li>
+<li class="listitem">
+ The contract class must define a public default constructor (i.e., with
+ no arguments) which constructs the base class <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>
+ passing function pointers to the body, precondition, and postcondition
+ (so the contract knows which function to invoke to execute the body,
+ check preconditions, and check postconditions).
+ </li>
+</ul></div>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top">
+<p>
+ The contract class is declared as a template using the <span class="emphasis"><em>artificial</em></span>
+ template parameter <code class="computeroutput"><span class="keyword">int</span> <span class="identifier">ZERO</span></code>
+ to support an internal library workaround. This allows the library to internally
+ use the <code class="computeroutput"><span class="keyword">typename</span></code> and <code class="computeroutput"><span class="keyword">template</span></code> keywords freely to explicitly characterize
+ types even without knowing if the contracted class is a template or not.
+ The artificial template parameter <code class="computeroutput"><span class="keyword">int</span>
+ <span class="identifier">ZERO</span></code> is not needed if the contracted
+ function is already a template (in which case <code class="computeroutput"><span class="keyword">int</span>
+ <span class="identifier">ZERO</span></code> is replaced by the actual
+ function template parameters).
+ </p>
+<p>
+ The value of artificial template parameter <code class="computeroutput"><span class="keyword">int</span>
+ <span class="identifier">ZERO</span></code> is not used so any value
+ can be specified. However, it is recommended to always specify the value
+ <code class="computeroutput"><span class="number">0</span></code> for consistency (this is
+ practice followed by this documentation).
+ </p>
+</td></tr>
+</table></div>
+<a name="contract__.without_the_macros.contract_class.contract_class_name"></a><h6>
+<a name="contract__.without_the_macros.contract_class.contract_class_name-heading"></a>
+ <a class="link" href="without_the_macros.html#contract__.without_the_macros.contract_class.contract_class_name">Contract
+ Class Name</a>
+ </h6>
+<p>
+ Note how, similarly to the precondition and postcondition function names,
+ the contract class name repeats the function name and the argument names.
+ Furthermore, for cv-qualified member functions, the contract class name should
+ end with the cv-qualifier. This is necessary to support contracts for overloaded
+ functions (with the limitation that overloaded functions, with the same number
+ of arguments and same constant qualifier, must have different argument names
+ and not just different argument types otherwise contract names will clash).
+ In summary, the contract class name should be as follow:
+ </p>
+<pre class="programlisting"><span class="identifier">contract_</span><span class="emphasis"><em>function-name</em></span><span class="identifier">_</span><span class="emphasis"><em>argument-name1</em></span><span class="identifier">_</span><span class="emphasis"><em>argument-name2</em></span><span class="identifier">_</span><span class="emphasis"><em>...argument-nameN</em></span><span class="identifier">_</span>/[/<span class="identifier">const_</span>/]//[/<span class="identifier">volatile_</span>/]/
+</pre>
+<p>
+ In order to allow the contract macros to subcontract from hand-written contracts,
+ you must follow the above convention in naming the contract class at all
+ times (because this is the convention that the contract macros assume).
+ </p>
+<p>
+ The contract class name begins with the <code class="computeroutput"><span class="identifier">contract</span></code>
+ prefix and ends with an underscore "<code class="computeroutput"><span class="identifier">_</span></code>"
+ thus programmers should never directly use this class in user code (see
+ <a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.static_member_functions"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.static_member_functions" title="Static Member Functions">Static
+ Member Functions</a>
+</h3></div></div></div>
+<p>
+ Contracts can also be programmed for static member functions (see the example
+ at the end of this section). However, compared with non-static member function
+ contracts the following differences apply:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>static_member_function</code>
+ class template is used instead of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>.
+ </li>
+<li class="listitem">
+ The class type cannot be tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ or qualified <code class="computeroutput"><span class="keyword">const</span></code> (because
+ there is no object to copy or to not modify).
+ </li>
+<li class="listitem">
+ The precondition, postcondition, and body functions must be <code class="computeroutput"><span class="keyword">static</span></code> members (and therefore they cannot
+ be <code class="computeroutput"><span class="keyword">const</span></code>).
+ </li>
+<li class="listitem">
+ No base contract class can be specified because <code class="computeroutput"><span class="keyword">static</span></code>
+ members cannot be <code class="computeroutput"><span class="keyword">virtual</span></code>
+ so they cannot subcontract.
+ </li>
+</ul></div>
+<p>
+ All these constraints are enforced by the library at compile-time.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.constructors"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.constructors" title="Constructors">Constructors</a>
+</h3></div></div></div>
+<p>
+ Contracts can also be programmed for constructors (see the example at the
+ end of this section). However, compared with non-static member function contracts
+ the following differences apply:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>constructor</code> class template
+ is used instead of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>.
+ </li>
+<li class="listitem">
+ The class type cannot be tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ or qualified <code class="computeroutput"><span class="keyword">const</span></code> (because
+ there is no object before body execution to copy and the object is always
+ modified by the body as it is constructed).
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>constructor</code> function type
+ template parameter must always specify a <code class="computeroutput"><span class="keyword">void</span></code>
+ return type (because constructors return no value).
+ </li>
+<li class="listitem">
+ The precondition function must be <code class="computeroutput"><span class="keyword">static</span></code>
+ because constructor preconditions cannot access the object (as there
+ is no object before constructor body execution).
+ </li>
+<li class="listitem">
+ The postcondition function always specifies <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>noold</code>
+ for the object old value because constructor postconditions can never
+ access the object old value (as there was no object before constructor
+ body execution). Furthermore, the function type passed to <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>constructor</code> cannot tag
+ the class type <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>.
+ </li>
+<li class="listitem">
+ No base contract class can be specified because constructors do not directly
+ subcontract (the C++ object construction mechanism will automatically
+ invoke the base class constructor contracts if present).
+ </li>
+</ul></div>
+<p>
+ All these constraints are enforced by the library at compile-time.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.destructors"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.destructors" title="Destructors">Destructors</a>
+</h3></div></div></div>
+<p>
+ Contracts can also be programmed for destructors (see the example at the
+ end of this section). However, compared with non-static member function contracts
+ the following differences apply:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>destructor</code> class template
+ is used instead of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>.
+ </li>
+<li class="listitem">
+ The class type cannot be tagged <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>
+ or qualified <code class="computeroutput"><span class="keyword">const</span></code> (because
+ there are no postconditions to accessed to copied object and the object
+ is always modified by the body as it is destructed).
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>destructor</code> function type
+ template parameter must always specify a <code class="computeroutput"><span class="keyword">void</span></code>
+ return type and have no argument (because destructors return no value
+ and have no argument). Furthermore, the function pointer cannot tag the
+ class type <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>copyable</code>.
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>destructor</code> constructor
+ only takes the body function pointer and it does not take the precondition
+ and postcondition function pointers (because destructors have no preconditions
+ and no postconditions as they have no arguments and there is no object
+ after destructor body execution).
+ </li>
+<li class="listitem">
+ No base contract class can be specified because destructors do not directly
+ subcontract (the C++ object destruction mechanism will automatically
+ invoke the base class destructor contracts if present).
+ </li>
+</ul></div>
+<p>
+ All these constraints are enforced by the library at compile-time.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.non_member_functions"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.non_member_functions" title="Non-Member Functions">Non-Member
+ Functions</a>
+</h3></div></div></div>
+<p>
+ Contracts can also be programmed for non-member functions (see the example
+ at the end of this section). However, compared with non-static member function
+ contracts the following differences apply:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ The <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonmember_function</code>
+ class template is used instead of <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonstatic_member_function</code>.
+ </li>
+<li class="listitem">
+ The function type passed as the first template parameter to <code class="computeroutput"><span class="identifier">contract</span><span class="special">::</span>nonmember_function</code>
+ does <span class="emphasis"><em>not</em></span> specify the class type (i.e., <span class="emphasis"><em>result-type</em></span><code class="computeroutput">
+ <span class="special">(</span></code><span class="emphasis"><em>argument-type1</em></span><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code>
+ is used instead of <span class="emphasis"><em>result-type</em></span><code class="computeroutput"> <span class="special">(</span></code><span class="emphasis"><em>class-type</em></span><code class="computeroutput"><span class="special">*,</span></code> <span class="emphasis"><em>argument-type1</em></span><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code>).
+ </li>
+<li class="listitem">
+ The precondition, postcondition, body functions, and the contract class
+ are not members.
+ </li>
+<li class="listitem">
+ The contracted function definition must be <code class="computeroutput"><span class="keyword">inline</span></code>
+ and it must appear at the very end of the contract after the precondition,
+ postcondition, body functions, and the contract class (to avoid duplicate
+ definitions and missing definitions compile-time errors).
+ </li>
+</ul></div>
+<p>
+ All these constraints are enforced by the library at compile-time.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="contract__.without_the_macros.a_fully_working_example__without_the_macros_"></a><a class="link" href="without_the_macros.html#contract__.without_the_macros.a_fully_working_example__without_the_macros_" title="A Fully Working Example (Without the Macros)">A
+ Fully Working Example (Without the Macros)</a>
+</h3></div></div></div>
+<p>
+ We conclude this section with a fully working example that can be compiled.
+ This example illustrates how to use the library to program contracts without
+ the macros.
+ </p>
+<p>
+ For simplicity, this example only exposes a limited subset of the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
+ operations and it only programs simple contracts for them (see the STL Vector
+ <a class="link" href="examples.html" title="Examples">Example</a> for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
+ complete contracts). Furthermore, the somewhat artificial base classes have
+ been deliberately introduced to illustrate subcontracting and they will probably
+ not be part of real code.
+ </p>
+<p>
+ Comparing this example with the one presented in the <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+ section, it is easy to note how much more setup code around the contract
+ assertions is required when the contract macros are not used. Therefore,
+ the use of the contract macros is always recommended.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="string">"pushable.hpp"</span> <span class="comment">// Base class for subcontracting.</span>
+<span class="preprocessor">#include</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="comment">// This library.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span> <span class="comment">// STL vector.</span>
+
+<span class="comment">// Wrapper that adds simple (not complete) contracts to C++ STL</span>
+<span class="comment">// without using the library contract macros.</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
+
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="comment">/* Allow for */</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="comment">/* optional contract */</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span> <span class="comment">/* compilation. */</span>
+ <span class="comment">// Augmented state.</span>
+ <span class="keyword">friend</span> <span class="keyword">class</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span><span class="special">;</span>
+ <span class="keyword">mutable</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">state</span> <span class="identifier">contract_state_</span><span class="special">;</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span>
+ <span class="comment">// Static class invariants</span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_static_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Assert nothing in this case.</span>
+ <span class="special">}</span>
+ <span class="comment">// Class invariants.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_invariant_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!((</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">empty</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More invariants here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// invariants</span>
+
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_reference</span> <span class="identifier">const_reference</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">const_iterator</span> <span class="identifier">const_iterator</span><span class="special">;</span>
+
+ <span class="comment">// Contract for constructor.</span>
+ <span class="keyword">explicit</span> <span class="identifier">myvector</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">):</span> <span class="identifier">vector_</span><span class="special">(</span><span class="identifier">count</span><span class="special">)</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">{</span>
+ <span class="identifier">contract_contract_constructor_count_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">count</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="comment">// Static preconditions (i.e., no object).</span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_precondition_contract_constructor_count_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">size_type</span><span class="special">&</span> <span class="identifier">count</span><span class="special">)</span> <span class="comment">/* no `const` (it is `static`) */</span> <span class="special">{</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">contract_postcondition_contract_constructor_count_</span><span class="special">(</span>
+ <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span> <span class="comment">// Always `noold` for old object.</span>
+ <span class="keyword">const</span> <span class="identifier">size_type</span><span class="special">&</span> <span class="identifier">count</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">count</span><span class="special">))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_contract_constructor_</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">count</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+ <span class="special">{</span>
+ <span class="comment">// Do nothing in this case</span>
+ <span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_contract_constructor_count_</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="comment">// Use `constructor` (not `function`).</span>
+ <span class="comment">// Class type can never be tagged `copyable`.</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*,</span> <span class="identifier">size_type</span><span class="special">)></span> <span class="special">{</span>
+ <span class="identifier">contract_contract_constructor_count_</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="keyword">void</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*,</span> <span class="identifier">size_type</span><span class="special">)</span>
+ <span class="special">>(</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_body_contract_constructor_</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_precondition_contract_constructor_count_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_postcondition_contract_constructor_count_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+ <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+ <span class="comment">// Contract for destructor.</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">myvector</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+ <span class="comment">// Destructors only check invariants.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span>
+ <span class="special">{</span>
+ <span class="identifier">contract_contract_destructor_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="keyword">this</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="comment">// No precondition and no postcondition functions.</span>
+ <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="identifier">contract_body_contract_destructor_</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// invariant</span>
+ <span class="special">{</span>
+ <span class="comment">// Do nothing in this case.</span>
+ <span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_contract_destructor_</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="comment">// Use `destructor` (not `function`).</span>
+ <span class="comment">// Class type can never be tagged `copyable`.</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*)></span> <span class="special">{</span>
+ <span class="identifier">contract_contract_destructor_</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="keyword">void</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*)</span>
+ <span class="special">>(&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_body_contract_destructor_</span> <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span>
+<span class="preprocessor">#endif</span> <span class="comment">// invariant</span>
+
+ <span class="comment">// Contract for non-static member functions.</span>
+ <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Contracted function.</span>
+ <span class="special">{</span>
+ <span class="identifier">contract_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="keyword">this</span> <span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span> <span class="comment">// Private so not to alter user call public API.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">contract_precondition_push_back_element_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">void</span> <span class="identifier">contract_postcondition_push_back_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special">*</span> <span class="identifier">contract_old_this_</span><span class="special">,</span> <span class="comment">// Old value for object.</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span> <span class="comment">// No old for element argument.</span>
+ <span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">contract_old_this_</span><span class="special">-></span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">)))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+<span class="keyword">protected</span><span class="special">:</span> <span class="comment">// Must be protected (not private) to allow subcontracting.</span>
+ <span class="keyword">void</span> <span class="identifier">contract_body_push_back_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+ <span class="comment">// Original function definition (the body).</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Contract class.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_push_back_element_</span><span class="special">:</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span>
+ <span class="comment">// Function type with class type pointer as 1st argument.</span>
+ <span class="comment">// Copyable class type for old object value in postconditions.</span>
+ <span class="comment">// For constant members, change `myvector` to `myvector const`.</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="comment">// Base contract class for subcontracting.</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span>
+ <span class="identifier">contract_virtual_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">></span> <span class="special">{</span>
+ <span class="comment">// Constructor specifies body, preconditions, and postconditions.</span>
+ <span class="identifier">contract_push_back_element_</span><span class="special">():</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonstatic_member_function</span><span class="special"><</span>
+ <span class="keyword">void</span> <span class="special">(</span><span class="identifier">contract</span><span class="special">::</span><span class="identifier">copyable</span><span class="special"><</span><span class="identifier">myvector</span><span class="special">>*,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&),</span>
+ <span class="keyword">typename</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="keyword">template</span>
+ <span class="identifier">contract_virtual_push_back_element_</span><span class="special"><</span><span class="number">0</span><span class="special">></span>
+ <span class="special">>(</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_body_push_back_</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_precondition_push_back_element_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="identifier">contract_postcondition_push_back_element_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+ <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span> <span class="comment">// Restore original access level.</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+ <span class="comment">// Contract for template plus static member function.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">></span>
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">all_equals</span><span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="comment">// Static members also check (static) class invariants.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">contract_all_equals_first_last_element_</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span>
+ <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">element</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="comment">// Static template precondition and postcondition functions.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">></span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_precondition_all_equals_first_last_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">Iter</span><span class="special">&</span> <span class="identifier">first</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Iter</span><span class="special">&</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+ <span class="comment">/* no `const` */</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">first</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">></span>
+ <span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">contract_postcondition_all_equals_first_last_element_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">Iter</span><span class="special">&</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">Iter</span><span class="special">&</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="keyword">bool</span><span class="special">&</span> <span class="identifier">result</span> <span class="special">)</span> <span class="comment">// Result value.</span>
+ <span class="comment">/* no `const` */</span> <span class="special">{</span>
+ <span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+<span class="keyword">protected</span><span class="special">:</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">></span>
+ <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">contract_body_all_equals_</span><span class="special">(</span>
+ <span class="identifier">Iter</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iter</span> <span class="identifier">last</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+ <span class="special">{</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">Iter</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">last</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(*</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">element</span><span class="special">)</span> <span class="keyword">return</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_CLASS_INVARIANT</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="comment">// Function template parameter `class Iter` already present so</span>
+ <span class="comment">// no artificial `int ZERO` parameter.</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Iter</span><span class="special">></span>
+ <span class="keyword">struct</span> <span class="identifier">contract_all_equals_first_last_element_</span><span class="special">:</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">static_member_function</span><span class="special"><</span>
+ <span class="keyword">bool</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*,</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span>
+ <span class="special">></span> <span class="special">{</span>
+ <span class="identifier">contract_all_equals_first_last_element_</span><span class="special">():</span> <span class="identifier">contract</span><span class="special">::</span> <span class="identifier">static_member_function</span><span class="special"><</span>
+ <span class="keyword">bool</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">*,</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="identifier">Iter</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span>
+ <span class="special">>(</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">contract_body_all_equals_</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">></span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">contract_precondition_all_equals_first_last_element_</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">></span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">myvector</span><span class="special">::</span><span class="keyword">template</span> <span class="identifier">contract_postcondition_all_equals_first_last_element_</span><span class="special"><</span><span class="identifier">Iter</span><span class="special">></span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+ <span class="special">)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+<span class="keyword">public</span><span class="special">:</span>
+<span class="preprocessor">#endif</span> <span class="comment">// contracts</span>
+
+ <span class="comment">// Similarly, complete contracts sketched here and add contracts</span>
+ <span class="comment">// for all other functions (see [Crowl2006] vector example).</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_reference</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span> <span class="identifier">index</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">[</span><span class="identifier">index</span><span class="special">];</span> <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// Contract for non-member function.</span>
+<span class="keyword">double</span> <span class="identifier">abs_total</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span><span class="special">)</span>
+<span class="comment">// Non-member members do not check invariants.</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+<span class="special">;</span>
+<span class="keyword">void</span> <span class="identifier">contract_precondition_abs_total_vector_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span> <span class="special">)</span> <span class="special">{</span>
+<span class="special">}</span>
+<span class="keyword">void</span> <span class="identifier">contract_postcondition_abs_total_vector_</span><span class="special">(</span>
+ <span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span><span class="special">,</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">noold</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">total</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(!(</span><span class="identifier">total</span> <span class="special">>=</span> <span class="number">0.0</span><span class="special">))</span>
+ <span class="keyword">throw</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">failure</span><span class="special">(</span><span class="identifier">__FILE__</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">);</span>
+<span class="special">}</span>
+<span class="keyword">double</span> <span class="identifier">contract_body_abs_total_</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span><span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions or postconditions</span>
+<span class="special">{</span>
+ <span class="keyword">double</span> <span class="identifier">total</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">total</span> <span class="special">==</span> <span class="number">0.0</span> <span class="special">);</span>
+ <span class="special">{</span>
+ <span class="identifier">CONTRACT_INIT_LOOP_VARIANT</span><span class="special">;</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_ASSERT_BLOCK_INVARIANT</span><span class="special">(</span> <span class="identifier">i</span> <span class="special"><</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">);</span>
+ <span class="identifier">CONTRACT_ASSERT_LOOP_VARIANT</span><span class="special">(</span> <span class="identifier">vector</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">-</span> <span class="identifier">i</span> <span class="special">);</span>
+
+ <span class="identifier">total</span> <span class="special">+=</span> <span class="identifier">vector</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+ <span class="keyword">return</span> <span class="identifier">total</span> <span class="special"><</span> <span class="number">0.0</span> <span class="special">?</span> <span class="special">-</span><span class="identifier">total</span> <span class="special">:</span> <span class="identifier">total</span><span class="special">;</span>
+<span class="special">}</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span> <span class="special">||</span> <span class="special">\</span>
+ <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">int</span> <span class="identifier">ZERO</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">contract_abs_total_vector_</span><span class="special">:</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonmember_function</span><span class="special"><</span>
+ <span class="comment">// Still use `function` but no class type pointer as 1st argument.</span>
+ <span class="keyword">double</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&)</span>
+ <span class="special">></span> <span class="special">{</span>
+ <span class="identifier">contract_abs_total_vector_</span><span class="special">():</span> <span class="identifier">contract</span><span class="special">::</span><span class="identifier">nonmember_function</span><span class="special"><</span>
+ <span class="keyword">double</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&)></span>
+ <span class="special">(</span> <span class="special">&</span><span class="identifier">contract_body_abs_total_</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_PRECONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">contract_precondition_abs_total_vector_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions</span>
+<span class="preprocessor">#if</span> <span class="identifier">defined</span> <span class="identifier">CONTRACT_CHECK_POSTCONDITION</span>
+ <span class="special">,</span> <span class="special">&</span><span class="identifier">contract_postcondition_abs_total_vector_</span>
+<span class="preprocessor">#endif</span> <span class="comment">// postconditions</span>
+ <span class="special">)</span> <span class="special">{}</span>
+<span class="special">};</span>
+<span class="comment">// Contracted function defined last and always `inline`.</span>
+<span class="keyword">inline</span> <span class="keyword">double</span> <span class="identifier">abs_total</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">myvector</span><span class="special"><</span><span class="keyword">double</span><span class="special">>&</span> <span class="identifier">vector</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">contract_abs_total_vector_</span><span class="special"><</span><span class="number">0</span><span class="special">>().</span><span class="identifier">call</span><span class="special">(</span><span class="identifier">vector</span><span class="special">);</span>
+<span class="special">}</span>
+<span class="preprocessor">#endif</span> <span class="comment">// preconditions or postconditions</span>
+
+</pre>
+<p>
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id913593" href="#id913593" class="para">16</a>] </sup>
+ A more natural syntax would have been to use C++ function pointer
+ types because they already provide a syntax for non-member functions
+ <span class="emphasis"><em>result-type</em></span><code class="computeroutput"> <span class="special">(*)(</span></code><span class="emphasis"><em>argument-type1</em></span><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code>
+ and a different syntax for member function <span class="emphasis"><em>result-type</em></span><code class="computeroutput">
+ <span class="special">(</span></code><span class="emphasis"><em>class-type</em></span><code class="computeroutput"><span class="special">::*)(</span></code><span class="emphasis"><em>argument-type1</em></span>,<code class="computeroutput">
+ <span class="special">...)</span></code>. However, the use
+ of function pointer types to resolve partial template specializations
+ (as needed by this library) it not fully supported by all compilers
+ (notably MVSC 8.0 has issues in resolving template specializations
+ between void constant and non-void constant member functions
+ using function pointer types). Therefore, the Boost.Function
+ preferred syntax was adopted for this library (also this harmonizes
+ this library more with the Boost
+ libraries). The Boost.Function
+ portable syntax was not used because it is maintained by Boost.Function
+ for backward compatibility only and it is not recommended (even
+ if that would have been the most portable syntax across the different
+ compilers, see Boost.Function
+ for more information).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id913920" href="#id913920" class="para">17</a>] </sup>
+ However, if the member function is constant it cannot modify
+ the object so there is in principle no need to copy the object
+ value before body execution because the body cannot modify the
+ object in the first place
+ </p></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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="examples.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/doc/html/boostbook.css 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,594 @@
+/*=============================================================================
+ Copyright (c) 2004 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompany-
+ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+/*=============================================================================
+ Body defaults
+=============================================================================*/
+
+ body
+ {
+ margin: 1em;
+ font-family: sans-serif;
+ }
+
+/*=============================================================================
+ Paragraphs
+=============================================================================*/
+
+ p
+ {
+ text-align: left;
+ font-size: 10pt;
+ line-height: 1.15;
+ }
+
+/*=============================================================================
+ Program listings
+=============================================================================*/
+
+ /* Code on paragraphs */
+ p tt.computeroutput
+ {
+ font-size: 9pt;
+ }
+
+ pre.synopsis
+ {
+ font-size: 90%;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ .programlisting,
+ .screen
+ {
+ font-size: 9pt;
+ display: block;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ /* Program listings in tables don't get borders */
+ td .programlisting,
+ td .screen
+ {
+ margin: 0pc 0pc 0pc 0pc;
+ padding: 0pc 0pc 0pc 0pc;
+ }
+
+/*=============================================================================
+ Headings
+=============================================================================*/
+
+ h1, h2, h3, h4, h5, h6
+ {
+ text-align: left;
+ margin: 1em 0em 0.5em 0em;
+ font-weight: bold;
+ }
+
+ h1 { font: 140% }
+ h2 { font: bold 140% }
+ h3 { font: bold 130% }
+ h4 { font: bold 120% }
+ h5 { font: italic 110% }
+ h6 { font: italic 100% }
+
+ /* Top page titles */
+ title,
+ h1.title,
+ h2.title
+ h3.title,
+ h4.title,
+ h5.title,
+ h6.title,
+ .refentrytitle
+ {
+ font-weight: bold;
+ margin-bottom: 1pc;
+ }
+
+ h1.title { font-size: 140% }
+ h2.title { font-size: 140% }
+ h3.title { font-size: 130% }
+ h4.title { font-size: 120% }
+ h5.title { font-size: 110% }
+ h6.title { font-size: 100% }
+
+ .section h1
+ {
+ margin: 0em 0em 0.5em 0em;
+ font-size: 140%;
+ }
+
+ .section h2 { font-size: 140% }
+ .section h3 { font-size: 130% }
+ .section h4 { font-size: 120% }
+ .section h5 { font-size: 110% }
+ .section h6 { font-size: 100% }
+
+ /* Code on titles */
+ h1 tt.computeroutput { font-size: 140% }
+ h2 tt.computeroutput { font-size: 140% }
+ h3 tt.computeroutput { font-size: 130% }
+ h4 tt.computeroutput { font-size: 120% }
+ h5 tt.computeroutput { font-size: 110% }
+ h6 tt.computeroutput { font-size: 100% }
+
+/*=============================================================================
+ Author
+=============================================================================*/
+
+ h3.author
+ {
+ font-size: 100%
+ }
+
+/*=============================================================================
+ Lists
+=============================================================================*/
+
+ li
+ {
+ font-size: 10pt;
+ line-height: 1.3;
+ }
+
+ /* Unordered lists */
+ ul
+ {
+ text-align: left;
+ }
+
+ /* Ordered lists */
+ ol
+ {
+ text-align: left;
+ }
+
+/*=============================================================================
+ Links
+=============================================================================*/
+
+ a
+ {
+ text-decoration: none; /* no underline */
+ }
+
+ a:hover
+ {
+ text-decoration: underline;
+ }
+
+/*=============================================================================
+ Spirit style navigation
+=============================================================================*/
+
+ .spirit-nav
+ {
+ text-align: right;
+ }
+
+ .spirit-nav a
+ {
+ color: white;
+ padding-left: 0.5em;
+ }
+
+ .spirit-nav img
+ {
+ border-width: 0px;
+ }
+
+/*=============================================================================
+ Copyright footer
+=============================================================================*/
+ .copyright-footer
+ {
+ text-align: right;
+ font-size: 70%;
+ }
+
+ .copyright-footer p
+ {
+ text-align: right;
+ font-size: 80%;
+ }
+
+/*=============================================================================
+ Table of contents
+=============================================================================*/
+
+ .toc
+ {
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.1pc 1pc 0.1pc 1pc;
+ font-size: 80%;
+ line-height: 1.15;
+ }
+
+ .boost-toc
+ {
+ float: right;
+ padding: 0.5pc;
+ }
+
+/*=============================================================================
+ Tables
+=============================================================================*/
+
+ .table-title,
+ div.table p.title
+ {
+ margin-left: 4%;
+ padding-right: 0.5em;
+ padding-left: 0.5em;
+ }
+
+ .informaltable table,
+ .table table
+ {
+ width: 92%;
+ margin-left: 4%;
+ margin-right: 4%;
+ }
+
+ div.informaltable table,
+ div.table table
+ {
+ padding: 4px;
+ }
+
+ /* Table Cells */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ padding: 0.5em;
+ text-align: left;
+ font-size: 9pt;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ border: 1pt solid white;
+ font-size: 80%;
+ }
+
+ table.simplelist
+ {
+ width: auto !important;
+ margin: 0em !important;
+ padding: 0em !important;
+ border: none !important;
+ }
+ table.simplelist td
+ {
+ margin: 0em !important;
+ padding: 0em !important;
+ text-align: left !important;
+ font-size: 9pt !important;
+ border: none !important;
+ }
+
+/*=============================================================================
+ Blurbs
+=============================================================================*/
+
+ div.note,
+ div.tip,
+ div.important,
+ div.caution,
+ div.warning,
+ p.blurb
+ {
+ font-size: 9pt; /* A little bit smaller than the main text */
+ line-height: 1.2;
+ display: block;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ p.blurb img
+ {
+ padding: 1pt;
+ }
+
+/*=============================================================================
+ Variable Lists
+=============================================================================*/
+
+ div.variablelist
+ {
+ margin: 1em 0;
+ }
+
+ /* Make the terms in definition lists bold */
+ div.variablelist dl dt,
+ span.term
+ {
+ font-weight: bold;
+ font-size: 10pt;
+ }
+
+ div.variablelist table tbody tr td
+ {
+ text-align: left;
+ vertical-align: top;
+ padding: 0em 2em 0em 0em;
+ font-size: 10pt;
+ margin: 0em 0em 0.5em 0em;
+ line-height: 1;
+ }
+
+ div.variablelist dl dt
+ {
+ margin-bottom: 0.2em;
+ }
+
+ div.variablelist dl dd
+ {
+ margin: 0em 0em 0.5em 2em;
+ font-size: 10pt;
+ }
+
+ div.variablelist table tbody tr td p,
+ div.variablelist dl dd p
+ {
+ margin: 0em 0em 0.5em 0em;
+ line-height: 1;
+ }
+
+/*=============================================================================
+ Misc
+=============================================================================*/
+
+ /* Title of books and articles in bibliographies */
+ span.title
+ {
+ font-style: italic;
+ }
+
+ span.underline
+ {
+ text-decoration: underline;
+ }
+
+ span.strikethrough
+ {
+ text-decoration: line-through;
+ }
+
+ /* Copyright, Legal Notice */
+ div div.legalnotice p
+ {
+ text-align: left
+ }
+
+/*=============================================================================
+ Colors
+=============================================================================*/
+
+ @media screen
+ {
+ body {
+ background-color: #FFFFFF;
+ color: #000000;
+ }
+
+ /* Links */
+ a
+ {
+ color: #005a9c;
+ }
+
+ a:visited
+ {
+ color: #9c5a9c;
+ }
+
+ h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
+ h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
+ h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited
+ {
+ text-decoration: none; /* no underline */
+ color: #000000;
+ }
+
+ /* Syntax Highlighting */
+ .keyword { color: #0000AA; }
+ .identifier { color: #000000; }
+ .special { color: #707070; }
+ .preprocessor { color: #402080; }
+ .char { color: teal; }
+ .comment { color: #800000; }
+ .string { color: teal; }
+ .number { color: teal; }
+ .white_bkd { background-color: #FFFFFF; }
+ .dk_grey_bkd { background-color: #999999; }
+
+ /* Copyright, Legal Notice */
+ .copyright
+ {
+ color: #666666;
+ font-size: small;
+ }
+
+ div div.legalnotice p
+ {
+ color: #666666;
+ }
+
+ /* Program listing */
+ pre.synopsis
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ .programlisting,
+ .screen
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ td .programlisting,
+ td .screen
+ {
+ border: 0px solid #DCDCDC;
+ }
+
+ /* Blurbs */
+ div.note,
+ div.tip,
+ div.important,
+ div.caution,
+ div.warning,
+ p.blurb
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ /* Tables */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ background-color: #F0F0F0;
+ border: 1px solid #DCDCDC;
+ }
+
+ .copyright-footer
+ {
+ color: #8F8F8F;
+ }
+
+ /* Misc */
+ span.highlight
+ {
+ color: #00A000;
+ }
+ }
+
+ @media print
+ {
+ /* Links */
+ a
+ {
+ color: black;
+ }
+
+ a:visited
+ {
+ color: black;
+ }
+
+ .spirit-nav
+ {
+ display: none;
+ }
+
+ /* Program listing */
+ pre.synopsis
+ {
+ border: 1px solid gray;
+ }
+
+ .programlisting,
+ .screen
+ {
+ border: 1px solid gray;
+ }
+
+ td .programlisting,
+ td .screen
+ {
+ border: 0px solid #DCDCDC;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ border: 1px solid gray;
+ }
+
+ .informaltable table,
+ .table table
+ {
+ border: 1px solid gray;
+ border-collapse: collapse;
+ }
+
+ /* Tables */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ border: 1px solid gray;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ border: 1px solid gray;
+ }
+
+ table.simplelist tr td
+ {
+ border: none !important;
+ }
+
+ /* Misc */
+ span.highlight
+ {
+ font-weight: bold;
+ }
+ }
+
+/*=============================================================================
+ Images
+=============================================================================*/
+
+ span.inlinemediaobject img
+ {
+ vertical-align: middle;
+ }
+
+/*==============================================================================
+ Super and Subscript: style so that line spacing isn't effected, see
+ http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341
+==============================================================================*/
+
+sup,
+sub {
+ height: 0;
+ line-height: 1;
+ vertical-align: baseline;
+ _vertical-align: bottom;
+ position: relative;
+
+}
+
+sup {
+ bottom: 1ex;
+}
+
+sub {
+ top: .5ex;
+}
+
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,2 @@
+Examples taken from Crowl, Ottosen, "Proposal to add Contract
+Programming to C++", 2006.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/block/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+int main() {
+ for (int i = 0; i < 100; ++i) {
+ // Invariant will intentionally fail.
+ CONTRACT_ASSERT_BLOCK_INVARIANT( i < 10 );
+
+ std::cout << i << std::endl;
+ }
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/circle/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,63 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+class shape {
+
+ CONTRACT_CLASS( (shape) )
+
+public:
+ virtual ~shape(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (shape)( (void) )
+ (body) ({
+ }) )
+
+ virtual int compute_area(void) const
+ CONTRACT_FUNCTION(
+ (public) (virtual) (int) (compute_area)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result > 0 );
+ })
+ (body) (
+ = 0; // Contract for pure virtual function.
+ ) )
+};
+
+class circle: public shape {
+
+ CONTRACT_CLASS( (circle) (shape) ) // Subcontracting from `shape`.
+
+public:
+ // Hard-coded radius for simplicity in this example.
+ int radius(void) const { return 2; }
+
+ virtual int compute_area(void) const
+ CONTRACT_FUNCTION( // Inherit `shape::copute_area()` contract.
+ (public) (virtual) (int) (compute_area)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == PI * radius() * radius() );
+ })
+ (body) ({
+ return PI * radius() * radius();
+ }) )
+
+private:
+ static const int PI = 3; // Truncated int of 3.14...
+};
+
+int main() {
+ circle c;
+
+ std::cout << std::endl << "compute_area()" << std::endl;
+ std::cout << c.compute_area() << std::endl;
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/factorial/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,37 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+// Recursion example.
+int factorial(int n)
+CONTRACT_FUNCTION(
+ (int) (factorial)( (int)(n) )
+(precondition) ({
+ CONTRACT_ASSERT( n >= 0 );
+ CONTRACT_ASSERT( n <= 12 );
+})
+(postcondition) (result) ({
+ CONTRACT_ASSERT( result >= 1 );
+
+ // Assertions disabled within assertions so factorial() can be
+ // recursively called also from the contract (not just the body).
+ // (Of course, this adds a lot of overhead...)
+ if (n < 2) { CONTRACT_ASSERT( result == 1 ); }
+ else { CONTRACT_ASSERT( result == n * factorial(n - 1) ); }
+})
+(body) ({
+ if (n < 2) return 1;
+ else return n * factorial(n - 1);
+}) )
+
+int main() {
+ std::cout << factorial(4) << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/equal.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,29 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef EQUAL_HPP_
+#define EQUAL_HPP_
+
+#include "not_equal.hpp"
+#include <contract.hpp>
+#include <iostream>
+
+template<typename T>
+bool operator==(T l, T r)
+CONTRACT_FUNCTION(
+ (template)( (typename)(T) )
+ (bool) (operator(==, equal)) ( (T)(l) (T)(r) )
+(postcondition) (result) ({
+ CONTRACT_ASSERT( result == !(l != r) );
+})
+(body) ({
+ std::clog << "checking for equality" << std::endl;
+ return l.value == r.value;
+}) )
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,23 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "equal.hpp"
+#include "not_equal.hpp"
+#include <iostream>
+
+struct number { double value; };
+
+int main() {
+ number n;
+ n.value = 1.23;
+
+ std::cout << (n == n) << std::endl;
+ std::cout << (n != n) << std::endl;
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/operator_equal/not_equal.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,28 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef NOT_EQUAL_HPP_
+#define NOT_EQUAL_HPP_
+
+#include "equal.hpp"
+#include <contract.hpp>
+
+template<typename T>
+bool operator!=(T l, T r)
+CONTRACT_FUNCTION(
+ (template)( (typename)(T) )
+ (bool) (operator(!=, not_equal))( (T)(l) (T)(r) )
+(postcondition) (result) ({
+ CONTRACT_ASSERT( result == !(l == r) );
+})
+(body) ({
+ std::clog << "checking for inequality" << std::endl;
+ return l.value != r.value;
+}) )
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/sqrt/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,37 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <cmath>
+#include <iostream>
+
+bool equal_within_precision(const double& x, const double& y,
+ const double& precision = 1e-6) {
+ return fabs(x - y) <= precision;
+}
+
+// Non-member function example.
+double mysqrt(double x)
+CONTRACT_FUNCTION(
+ (double) (mysqrt)( (double)(x) )
+(precondition) ({
+ CONTRACT_ASSERT( x >= 0.0 );
+})
+(postcondition) (root) ({
+ CONTRACT_ASSERT( equal_within_precision(root * root, x) );
+})
+(body) ({
+ return sqrt(x);
+}) )
+
+int main() {
+ std::cout << mysqrt(4.0) << std::endl;
+ std::cout << std::endl;
+ std::cout << mysqrt(-1.0) << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,18 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "sum.hpp"
+#include <iostream>
+
+int main() {
+ double a[8] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
+
+ std::cout << sum(8, a) << std::endl;
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,15 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "sum.hpp"
+
+double CONTRACT_BODY(sum)(int count, double* array) {
+ double accum = 0.0;
+ for (int i = 0; i < count; ++i) accum += array[i];
+ return accum;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/sum/sum.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,23 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef SUM_HPP_
+#define SUM_HPP_
+
+#include <contract.hpp>
+
+double sum(int count, double* array)
+CONTRACT_FUNCTION( (double) (sum)( (int)(count) (double*)(array) )
+(precondition) ({
+ CONTRACT_ASSERT( count % 4 == 0 );
+})
+(body) (
+ ;
+) )
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Crowl2006/vector/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,618 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <boost/utility.hpp> // For boost::prior().
+#include <vector>
+
+// Tools to write the contracts (for convenience).
+
+template<class Iter, class T>
+bool all_equals(Iter first, Iter last, const T& val)
+CONTRACT_FUNCTION(
+ (template)( (class)(Iter) (class)(T) )
+ (bool) (all_equals)(
+ (Iter)(first) (Iter)(last) (const T&)(val) )
+(body) ({
+ // For simplicity, let's assume T can be compared.
+ for (Iter i = first; i < last; ++i) {
+ if (*i != val) return false;
+ }
+ return true;
+}) )
+
+template<class Iter, class Size>
+bool equal_distance(Iter first, Iter last, Size size)
+CONTRACT_FUNCTION(
+ (template)( (class)(Iter) (class)(Size) )
+ (bool) (equal_distance)(
+ (Iter)(first) (Iter)(last) (Size)(size) )
+(body) ({
+ // Could implement internal tagging to support input iterators.
+ return int(size) == std::distance(first, last);
+}) )
+
+// New vector interface.
+
+template<class T, class Alloc = std::allocator<T> >
+class vector {
+
+ CONTRACT_CLASS( (vector)
+ (invariant) ({
+ CONTRACT_ASSERT( (size() == 0) == empty() );
+ CONTRACT_ASSERT( int(size()) == std::distance(begin(), end()) );
+ CONTRACT_ASSERT( int(size()) == std::distance(rbegin(), rend()) );
+ CONTRACT_ASSERT( size() <= capacity() );
+ CONTRACT_ASSERT( capacity() <= max_size() );
+ }) )
+
+public:
+ typedef typename std::vector<T, Alloc>::size_type size_type;
+ typedef typename std::vector<T, Alloc>::iterator iterator;
+ typedef typename std::vector<T, Alloc>::const_iterator
+ const_iterator;
+ typedef typename std::vector<T, Alloc>::reverse_iterator
+ reverse_iterator;
+ typedef typename std::vector<T, Alloc>::const_reverse_iterator
+ const_reverse_iterator;
+ typedef typename std::vector<T, Alloc>::reference reference;
+ typedef typename std::vector<T, Alloc>::const_reference
+ const_reference;
+
+ vector(void): vector_()
+ CONTRACT_CONSTRUCTOR(
+ (public) (vector)( (void) )
+ (postcondition) ({
+ CONTRACT_ASSERT( empty() );
+ })
+ (body) ({
+ }) )
+
+ explicit vector(const Alloc& al): vector_(al)
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (vector)( (const Alloc&)(al) )
+ (postcondition) ({
+ CONTRACT_ASSERT( empty() );
+ CONTRACT_ASSERT( al == get_allocator() );
+ })
+ (body) ({
+ }) )
+
+ explicit vector(size_type count): vector_(count)
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (vector)( (size_type)(count) )
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == count );
+ CONTRACT_ASSERT( all_equals(begin(), end(), T()) );
+ })
+ (body) ({
+ }) )
+
+ vector(size_type count, const T& val): vector_(count, val)
+ CONTRACT_CONSTRUCTOR(
+ (public) (vector)( (size_type)(count) (const T&)(val) )
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == count );
+ CONTRACT_ASSERT( all_equals(begin(), end(), val) );
+ })
+ (body) ({
+ }) )
+
+ vector(size_type count, const T& val, const Alloc& al):
+ vector_(count, val, al)
+ CONTRACT_CONSTRUCTOR(
+ (public) (vector)( (size_type)(count) (const T&)(val)
+ (const Alloc&)(al) )
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == count );
+ CONTRACT_ASSERT( all_equals(begin(), end(), val) );
+ CONTRACT_ASSERT( al == get_allocator() );
+ })
+ (body) ({
+ }) )
+
+ vector(const vector& right): vector_(right.vector_)
+ CONTRACT_CONSTRUCTOR(
+ (public) (vector)( (const vector&)(right) )
+ (postcondition) ({
+ CONTRACT_ASSERT( right == *this );
+ })
+ (body) ({
+ }) )
+
+ template<class InIt>
+ vector(InIt first, InIt last): vector_(first, last)
+ CONTRACT_CONSTRUCTOR(
+ (public) (template)( (class)(InIt) )
+ (vector)( (InIt)(first) (InIt)(last) )
+ (postcondition) ({
+ CONTRACT_ASSERT( equal_distance(first, last, size()) );
+ })
+ (body) ({
+ }) )
+
+ template<class InIt>
+ vector(InIt first, InIt last, const Alloc& al):
+ vector_(first, last, al)
+ CONTRACT_CONSTRUCTOR(
+ (public) (template)( (class)(InIt) )
+ (vector)( (InIt)(first) (InIt)(last) (const Alloc&)(al) )
+ (postcondition) ({
+ CONTRACT_ASSERT( equal_distance(first, last, size()) );
+ CONTRACT_ASSERT( al == get_allocator() );
+ })
+ (body) ({
+ }) )
+
+ ~vector(void) // Contracted so destructor checks invariants.
+ CONTRACT_DESTRUCTOR(
+ (public) (vector)( (void) )
+ (body) ({
+ }) )
+
+ void reserve(size_type count)
+ CONTRACT_FUNCTION(
+ (public) (void) (reserve)( (size_type)(count) )
+ (precondition) ({
+ CONTRACT_ASSERT( count < max_size() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( capacity() >= count );
+ })
+ (body) ({
+ vector_.reserve(count);
+ }) )
+
+ size_type capacity(void) const
+ CONTRACT_FUNCTION(
+ (public) (size_type) (capacity)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result >= size() );
+ })
+ (body) ({
+ return vector_.capacity();
+ }) )
+
+ iterator begin(void)
+ CONTRACT_FUNCTION(
+ (public) (iterator) (begin)( (void) )
+ (postcondition) (result) ({
+ if (empty()) CONTRACT_ASSERT( result == end() );
+ })
+ (body) ({
+ return vector_.begin();
+ }) )
+
+ const_iterator begin(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_iterator) (begin)( (void) ) (const)
+ (postcondition) (result) ({
+ if (empty()) CONTRACT_ASSERT( result == end() );
+ })
+ (body) ({
+ return vector_.begin();
+ }) )
+
+ iterator end(void)
+ CONTRACT_FUNCTION(
+ (public) (iterator) (end)( (void) )
+ // Contracted even if no pre/post condition so check invariants.
+ (body) ({
+ return vector_.end();
+ }) )
+
+ const_iterator end(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_iterator) (end)( (void) ) (const)
+ (body) ({
+ return vector_.end();
+ }) )
+
+ reverse_iterator rbegin(void)
+ CONTRACT_FUNCTION(
+ (public) (reverse_iterator) (rbegin)( (void) )
+ (postcondition) (result) ({
+ if (empty()) CONTRACT_ASSERT( result == rend() );
+ })
+ (body) ({
+ return vector_.rbegin();
+ }) )
+
+ const_reverse_iterator rbegin(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_reverse_iterator) (rbegin)( (void) ) (const)
+ (postcondition) (result) ({
+ if (empty()) CONTRACT_ASSERT( result == rend() );
+ })
+ (body) ({
+ return vector_.rbegin();
+ }) )
+
+ reverse_iterator rend(void)
+ CONTRACT_FUNCTION(
+ (public) (reverse_iterator) (rend)( (void) )
+ (body) ({
+ return vector_.rend();
+ }) )
+
+ const_reverse_iterator rend(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_reverse_iterator) (rend)( (void) ) (const)
+ (body) ({
+ return vector_.rend();
+ }) )
+
+ void resize(size_type newsize)
+ CONTRACT_FUNCTION(
+ (public) (void) (resize)( (size_type)(newsize) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == newsize );
+ // Version 1: with an if.
+ if (newsize > CONTRACT_OLDOF(this)->size()) CONTRACT_ASSERT(
+ all_equals(begin() + CONTRACT_OLDOF(this)->size(),
+ end(), T()) );
+ })
+ (body) ({
+ vector_.resize(newsize);
+ }) )
+
+ void resize(size_type newsize, T val)
+ CONTRACT_FUNCTION(
+ (public) (void) (resize)( (size_type)(newsize) (T)(val) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == newsize );
+ // Version 2: with a ternary operator.
+ CONTRACT_ASSERT( newsize > CONTRACT_OLDOF(this)->size() ?
+ all_equals(begin() + CONTRACT_OLDOF(this)->size(),
+ end(), val) : true );
+ })
+ (body) ({
+ vector_.resize(newsize, val);
+ }) )
+
+ size_type size(void) const
+ CONTRACT_FUNCTION(
+ (public) (size_type) (size)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result <= capacity() );
+ })
+ (body) ({
+ return vector_.size();
+ }) )
+
+ size_type max_size(void) const
+ CONTRACT_FUNCTION(
+ (public) (size_type) (max_size)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result >= capacity() );
+ })
+ (body) ({
+ return vector_.max_size();
+ }) )
+
+ bool empty(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (empty)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == (size() == 0) );
+ })
+ (body) ({
+ return vector_.empty();
+ }) )
+
+ Alloc get_allocator(void) const
+ CONTRACT_FUNCTION(
+ (public) (Alloc) (get_allocator)( (void) ) (const)
+ (body) ({
+ return vector_.get_allocator();
+ }) )
+
+ reference at(size_type off)
+ CONTRACT_FUNCTION(
+ (public) (reference) (at)( (size_type)(off) )
+ (precondition) ({
+ CONTRACT_ASSERT( off < size() );
+ })
+ (body) ({
+ return at(off);
+ }) )
+
+ const_reference at(size_type off) const
+ CONTRACT_FUNCTION(
+ (public) (const_reference) (at)( (size_type)(off) )
+ (const)
+ (precondition) ({
+ CONTRACT_ASSERT( off < size() );
+ })
+ (body) ({
+ return at(off);
+ }) )
+
+ reference operator[](size_type off)
+ CONTRACT_FUNCTION(
+ (public) (reference) (operator_at)( (size_type)(off) )
+ (precondition) ({
+ CONTRACT_ASSERT( off < size() );
+ })
+ (body) ({
+ return operator[](off);
+ }) )
+
+ const_reference operator[](size_type off) const
+ CONTRACT_FUNCTION(
+ (public) (const_reference) (operator_at)(
+ (size_type)(off) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( off < size() );
+ })
+ (body) ({
+ return operator[](off);
+ }) )
+
+ reference front(void)
+ CONTRACT_FUNCTION(
+ (public) (reference) (front)( (void) )
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (body) ({
+ return vector_.front();
+ }) )
+
+ const_reference front(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_reference) (front)( (void) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (body) ({
+ return vector_.front();
+ }) )
+
+ reference back(void)
+ CONTRACT_FUNCTION(
+ (public) (reference) (back)( (void) )
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (body) ({
+ return vector_.back();
+ }) )
+
+ const_reference back(void) const
+ CONTRACT_FUNCTION(
+ (public) (const_reference) (back)( (void) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (body) ({
+ return vector_.back();
+ }) )
+
+ void push_back(const T& val)
+ CONTRACT_FUNCTION(
+ (public) (void) (push_back)( (const T&)(val) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( size() < max_size() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( back() == val );
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() + 1) );
+ CONTRACT_ASSERT( capacity() >= CONTRACT_OLDOF(this)->capacity() );
+ })
+ (body) ({
+ vector_.push_back(val);
+ }) )
+
+ void pop_back(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (pop_back)( (void) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() - 1) );
+ })
+ (body) ({
+ vector_.pop_back();
+ }) )
+
+ template<class InIt>
+ void assign(InIt first, InIt last)
+ CONTRACT_FUNCTION(
+ (public) (template)( (class)(InIt) )
+ (void) (assign)( (InIt)(first) (InIt)(last) )
+ (precondition) ({
+ /** @pre [first, last) not sub-range of [begin(), end()). */
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( equal_distance(first, last, size()) );
+ })
+ (body) ({
+ vector_.assign(first, last);
+ }) )
+
+ void assign(size_type count, const T& val)
+ CONTRACT_FUNCTION(
+ (public) (void) (assign)(
+ (size_type)(count) (const T&)(val) )
+ (precondition) ({
+ CONTRACT_ASSERT( count <= max_size() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( all_equals(begin(), end(), val) );
+ })
+ (body) ({
+ vector_.assign(count, val);
+ }) )
+
+ iterator insert(iterator where, const T& val)
+ CONTRACT_FUNCTION(
+ (public) (iterator) (insert)(
+ (iterator)(where) (const T&)(val) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( size() < max_size() );
+ })
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( *result == val );
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() + 1) );
+ CONTRACT_ASSERT( capacity() >= CONTRACT_OLDOF(this)->capacity() );
+ /** @post
+ * if capacity() > oldof capacity():
+ * all iterators invalidated
+ * else:
+ * all iterators in [where, end()) invalidated
+ */
+ })
+ (body) ({
+ return vector_.insert(where, val);
+ }) )
+
+ void insert(iterator where, size_type count, const T& val)
+ CONTRACT_FUNCTION(
+ (public) (void) (insert)( (copyable)(iterator)(where)
+ (size_type)(count) (const T&)(val) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( (size() + count) < max_size() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( size() ==
+ (CONTRACT_OLDOF(this)->size() + count) );
+ CONTRACT_ASSERT( capacity() >= CONTRACT_OLDOF(this)->capacity() );
+ if (capacity() == CONTRACT_OLDOF(this)->capacity()) {
+ CONTRACT_ASSERT( all_equals(
+ boost::prior(CONTRACT_OLDOF(where)),
+ boost::prior(CONTRACT_OLDOF(where)) + count,
+ val) );
+ /** @post All iterators in [where, end()) invalidated. */
+ }
+ else {
+ /** @post All iterators invalidated. */
+ }
+ })
+ (body) ({
+ vector_.insert(where, val);
+ }) )
+
+ template<class InIt>
+ void insert(iterator where, InIt first, InIt last)
+ CONTRACT_FUNCTION(
+ (public) (template)( (class)(InIt) )
+ (void) (insert)( (copyable)(iterator)(where)
+ (InIt)(first) (InIt)(last) ) (copyable)
+ (precondition) ({
+ /** @pre [first, last) not a sub-range or [begin(), end()). */
+ int count = std::distance(first, last);
+ CONTRACT_ASSERT( (size() + count) < max_size() );
+ })
+ (postcondition) ({
+ int count = std::distance(first, last);
+ CONTRACT_ASSERT( size() ==
+ (CONTRACT_OLDOF(this)->size() + count) );
+ CONTRACT_ASSERT( capacity() >= CONTRACT_OLDOF(this)->capacity() );
+ })
+ (body) ({
+ return vector_.insert(where, first, last);
+ }) )
+
+ iterator erase(iterator where)
+ CONTRACT_FUNCTION(
+ (public) (iterator) (erase)( (iterator)(where) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ CONTRACT_ASSERT( where != end() );
+ })
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() - 1) );
+ if (empty()) CONTRACT_ASSERT( result == end() );
+ /** @post Iterators in [where, end()) invalidated. */
+ })
+ (body) ({
+ return vector_.erase(where);
+ }) )
+
+ iterator erase(iterator first, iterator last)
+ CONTRACT_FUNCTION(
+ (public) (iterator) (erase)( (iterator)(first)
+ (iterator)(last) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( size() >= std::distance(first, last) );
+ })
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( size() == (CONTRACT_OLDOF(this)->size() -
+ std::distance(first, last)) );
+ if (empty()) CONTRACT_ASSERT( result == end() );
+ /** @post Iterators in [first, end()) invalidated. */
+ })
+ (body) ({
+ return vector_.erase(first, last);
+ }) )
+
+ void clear(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (clear)( (void) )
+ (postcondition) ({
+ CONTRACT_ASSERT( empty() );
+ })
+ (body) ({
+ vector_.clear();
+ }) )
+
+ void swap(vector& right)
+ CONTRACT_FUNCTION(
+ (public) (void) (swap)( (copyable)(vector&)(right) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( *CONTRACT_OLDOF(this) == right );
+ CONTRACT_ASSERT( CONTRACT_OLDOF(right) == *this );
+ })
+ (body) ({
+ vector_.swap(right);
+ }) )
+
+ bool operator==(const vector& right) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (operator_equal)(
+ (const vector&)(right) ) (const)
+ (body) ({
+ return vector_ == right.vector_;
+ }) )
+
+private:
+ std::vector<T, Alloc> vector_;
+};
+
+int main() {
+ // Run a few of the operations (could test more of them...).
+ std::cout << std::endl << "constructor()" << std::endl;
+ vector<double> v(3);
+ const vector<double>& cv = v; // A reference, no copy.
+
+ std::cout << std::endl << "copy constructor()" << std::endl;
+ vector<double> w(v);
+
+ std::cout << std::endl << "begin()" << std::endl;
+ vector<double>::iterator b = v.begin();
+ std::cout << *b << std::endl;
+
+ std::cout << std::endl << "begin() const" << std::endl;
+ vector<double>::const_iterator cb = cv.begin();
+ std::cout << *cb << std::endl;
+
+ std::cout << std::endl << "insert()" << std::endl;
+ v.insert(b, 2, -3.21);
+
+ std::cout << std::endl << "operator[]" << std::endl;
+ double v0 = v[0];
+ std::cout << v0 << std::endl;
+
+ std::cout << std::endl << "push_back()" << std::endl;
+ v.push_back(1.23);
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Makefile 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,191 @@
+# Copyright (C) 2009-2010 Lorenzo Caminiti.
+# Use, modification, and distribution is subject to the
+# Contract++ Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt.)
+
+# Supported C++ compliers `make CXX=compiler ...', where compiler is:
+# GCC GNU g++ (e.g., on Linux) (default)
+# MSVC Microsoft Visual C++ (e.g., on Cygwin)
+CXX=GCC
+
+bin:=./bin
+ifeq ($(CXX), GCC)
+ cpp_nodef:=g++ -Wall -Werror -I./src
+ def:=-D
+ out:=-o
+ dbg:=-g
+endif
+ifeq ($(CXX), MSVC)
+ # Don't use /Wall for MSVC has very verbose warnings (even in Boost?!).
+ cpp_nodef:=source $(bin)/env-MSVC8.sh && cl.exe /EHsc /I./src
+ def:=/D
+ out:=/Fe
+ dbg:=/Zi
+endif
+cpp:=$(cpp_nodef)
+ifeq ($(debug), 1)
+ cpp:=$(cpp) $(dbg) $(def)CONTRACT_CONFIG_DEBUG_=1
+endif
+ifneq ($(block_inv), 0)
+ cpp:=$(cpp) $(def)CONTRACT_CHECK_BLOCK_INVARIANT
+endif
+ifneq ($(class_inv), 0)
+ cpp:=$(cpp) $(def)CONTRACT_CHECK_CLASS_INVARIANT
+endif
+ifneq ($(pre), 0)
+ cpp:=$(cpp) $(def)CONTRACT_CHECK_PRECONDITION
+endif
+ifneq ($(post), 0)
+ cpp:=$(cpp) $(def)CONTRACT_CHECK_POSTCONDITION
+endif
+
+src:=./example
+build:=./build/example
+codedoc:=./codedoc/example
+
+all: Contract N1962 Mitchell2002 Meyer1997 Stroustrup1997 Boost_ConceptCheck Boost_Parameter
+
+clean:
+ rm -rf $(build)
+
+mkdir_:
+ mkdir -p $(build)
+
+Contract: push_back myvector myvector_checks myvector_nomacros myvector_nomacros_checks commas throw_on_failure storage_classifier friend exception_specs struct cv_qualifier inline extern
+push_back: mkdir_
+ $(cpp) $(src)/Contract/myvector/push_back.cpp $(out)$(build)/push_back
+myvector: mkdir_
+ $(cpp) $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector
+myvector_checks: mkdir_
+ # Compile with all different contract checking combinations.
+ $(cpp_nodef) $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_none
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_inv
+ $(cpp_nodef) $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_inv
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_inv_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_inv_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_inv_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)Contract//myvector/main.cpp $(out)$(build)/myvector-check_block_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_inv_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_inv_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main.cpp $(out)$(build)/myvector-check_block_inv_pre_post
+myvector_nomacros: mkdir_
+ $(cpp) $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros
+myvector_nomacros_checks: mkdir_
+ # Compile with all different contract checking combinations.
+ $(cpp_nodef) $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_none
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_inv
+ $(cpp_nodef) $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_inv
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_inv_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_inv_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_inv_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_pre_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_inv_post
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_inv_pre
+ $(cpp_nodef) $(def)CONTRACT_CHECK_BLOCK_INVARIANT $(def)CONTRACT_CHECK_CLASS_INVARIANT $(def)CONTRACT_CHECK_PRECONDITION $(def)CONTRACT_CHECK_POSTCONDITION $(src)/Contract/myvector/main_nomacros.cpp $(out)$(build)/myvector_nomacros-check_block_inv_pre_post
+commas: mkdir_
+ $(cpp) $(src)/Contract/commas/main.cpp $(out)$(build)/commas
+throw_on_failure: mkdir_
+ $(cpp) $(src)/Contract/throw_on_failure/main.cpp $(out)$(build)/throw_on_failure
+storage_classifier: mkdir_
+ $(cpp) $(src)/Contract/storage_classifier/main.cpp $(out)$(build)/storage_classifier
+friend: mkdir_
+ $(cpp) $(src)/Contract/friend/main.cpp $(out)$(build)/friend
+exception_specs: mkdir_
+ $(cpp) $(src)/Contract/exception_specs/main.cpp $(out)$(build)/exception_specs
+struct: mkdir_
+ $(cpp) $(src)/Contract/struct/main.cpp $(out)$(build)/struct
+cv_qualifier: mkdir_
+ $(cpp) $(src)/Contract/cv_qualifier/main.cpp $(out)$(build)/cv_qualifier
+inline: mkdir_
+ $(cpp) $(src)/Contract/inline/main.cpp $(out)$(build)/inline
+extern: mkdir_
+ $(cpp) $(src)/Contract/extern/main.cpp $(out)$(build)/extern
+
+N1962: sqrt block sum factorial circle operator_equal vector
+sqrt: mkdir_
+ $(cpp) $(src)/N1962/sqrt/main.cpp $(out)$(build)/sqrt
+block: mkdir_
+ $(cpp) $(src)/N1962/block/main.cpp $(out)$(build)/block
+sum: mkdir_
+ $(cpp) $(src)/N1962/sum/sum.cpp $(src)/N1962/sum/main.cpp $(out)$(build)/sum
+factorial: mkdir_
+ $(cpp) $(src)/N1962/factorial/main.cpp $(out)$(build)/factorial
+circle: mkdir_
+ $(cpp) $(src)/N1962/circle/main.cpp $(out)$(build)/circle
+operator_equal: mkdir_
+ $(cpp) $(src)/N1962/operator_equal/main.cpp $(out)$(build)/operator_equal
+vector: mkdir_
+ $(cpp) $(src)/N1962/vector/main.cpp $(out)$(build)/vector
+
+Mitchell2002: name_list stack simple_queue dictionary courier customer_manager observe counter
+name_list: mkdir_
+ $(cpp) $(src)/Mitchell2002/name_list/names.cpp $(src)/Mitchell2002/name_list/main.cpp $(out)$(build)/name_list
+stack: mkdir_
+ $(cpp) $(src)/Mitchell2002/stack/main.cpp $(out)$(build)/stack
+simple_queue: mkdir_
+ $(cpp) $(src)/Mitchell2002/simple_queue/main.cpp $(out)$(build)/simple_queue
+dictionary: mkdir_
+ $(cpp) $(src)/Mitchell2002/dictionary/main.cpp $(out)$(build)/dictionary
+courier: mkdir_
+ $(cpp) $(src)/Mitchell2002/courier/couriers.cpp $(src)/Mitchell2002/courier/main.cpp $(out)$(build)/courier
+customer_manager: mkdir_
+ $(cpp) $(src)/Mitchell2002/customer_manager/customer_manager.cpp $(src)/Mitchell2002/customer_manager/main.cpp $(out)$(build)/customer_manager
+observe: mkdir_
+ $(cpp) $(src)/Mitchell2002/observe/main.cpp $(out)$(build)/observe
+counter: mkdir_
+ $(cpp) $(src)/Mitchell2002/counter/main.cpp $(out)$(build)/counter
+
+Meyer1997: stack4 stack3 gcd maxarray
+stack4: mkdir_
+ $(cpp) $(src)/Meyer1997/stack4/main.cpp $(out)$(build)/stack4
+stack3: mkdir_
+ $(cpp) $(src)/Meyer1997/stack3/main.cpp $(out)$(build)/stack3
+gcd: mkdir_
+ $(cpp) $(src)/Meyer1997/gcd/main.cpp $(out)$(build)/gcd
+maxarray: mkdir_
+ $(cpp) $(src)/Meyer1997/maxarray/main.cpp $(out)$(build)/maxarray
+
+Stroustrup1997: string
+string: mkdir_
+ $(cpp) $(src)/Stroustrup1997/string/string.cpp $(src)/Stroustrup1997/string/main.cpp $(out)$(build)/string
+
+Boost_ConceptCheck: my_stable_sort my_stable_sort_def sum_n sum_iter calculator
+my_stable_sort: mkdir_
+ $(cpp) $(src)/Boost_ConceptCheck/my_stable_sort.cpp $(out)$(build)/my_stable_sort
+my_stable_sort_def: mkdir_
+ $(cpp) $(src)/Boost_ConceptCheck/my_stable_sort.cpp $(out)$(build)/my_stable_sort_def
+sum_n: mkdir_
+ $(cpp) $(src)/Boost_ConceptCheck/sum_n.cpp $(out)$(build)/sum_n
+sum_iter: mkdir_
+ $(cpp) $(src)/Boost_ConceptCheck/sum_iter.cpp $(out)$(build)/sum_iter
+calculator: mkdir_
+ $(cpp) $(src)/Boost_ConceptCheck/calculator.cpp $(out)$(build)/calculator
+
+Boost_Parameter: inc mygraph_dfs mygraph_dfs_def mypython_def callable2 myclass keywords
+inc: mkdir_
+ $(cpp) $(src)/Boost_Parameter/inc.cpp $(out)$(build)/inc
+mygraph_dfs: mkdir_
+ $(cpp) $(src)/Boost_Parameter/mygraph_dfs.cpp $(out)$(build)/mygraph_dfs
+mygraph_dfs_def: mkdir_
+ $(cpp) $(src)/Boost_Parameter/mygraph_dfs_def.cpp $(out)$(build)/mygraph_dfs_def
+mypython_def: mkdir_
+ $(cpp) $(src)/Boost_Parameter/mypython_def.cpp $(out)$(build)/mypython_def
+callable2: mkdir_
+ $(cpp) $(src)/Boost_Parameter/callable2.cpp $(out)$(build)/callable2
+myclass: mkdir_
+ $(cpp) $(src)/Boost_Parameter/myclass.cpp $(out)$(build)/myclass
+keywords: mkdir_
+ $(cpp) $(src)/Boost_Parameter/keywords.cpp $(out)$(build)/keywords
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,2 @@
+Examples of contract mainly ported from Eiffel.
+Adapted from book "Object Oriented Software Construction", 1997.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/gcd/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,55 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+#include <algorithm>
+
+/** Calculate greater common divisor of given positive integers. */
+int gcd(const int& a, const int& b)
+CONTRACT_FUNCTION(
+ (int)(gcd)( (const int&)(a) (const int&)(b) )
+(precondition) ({
+ CONTRACT_ASSERT( a > 0 );
+ CONTRACT_ASSERT( b > 0 );
+})
+(postcondition) (result) ({
+ /** @post result is greatest common divisor of a and b */
+})
+(body) ({
+ int x = a;
+ int y = b;
+ // Block invariants can apper in any code block (not just loop).
+ CONTRACT_ASSERT_BLOCK_INVARIANT( x == a );
+ CONTRACT_ASSERT_BLOCK_INVARIANT( y == b );
+
+ // Loop variant and invariants.
+ for (CONTRACT_INIT_LOOP_VARIANT; x != y; ) {
+ CONTRACT_ASSERT_BLOCK_INVARIANT( x > 0 );
+ CONTRACT_ASSERT_BLOCK_INVARIANT( y > 0 );
+ /** @inv gcd(x, y) == gcd(a, b) */
+ CONTRACT_ASSERT_LOOP_VARIANT( std::max(x, y) );
+
+ if (x > y) x = x - y;
+ else y = y - x;
+ }
+
+ return x;
+}) )
+
+int main() {
+ int a = 12, b = 18;
+ std::cout << "gcd(" << a << ", " << b << ") = "
+ << gcd(a, b) << std::endl;
+
+ a = 4; b = 14;
+ std::cout << "gcd(" << a << ", " << b << ") = "
+ << gcd(a, b) << std::endl;
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/maxarray/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,41 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <algorithm>
+#include <iostream>
+
+int maxarray(const int* array, const size_t& size)
+CONTRACT_FUNCTION(
+ (int) (maxarray)( (const int*)(array) (const size_t&)(size) )
+(precondition) ({
+ CONTRACT_ASSERT( size >= 1 );
+})
+(body) ({
+ size_t i = 0;
+ int result = array[i];
+
+ CONTRACT_INIT_LOOP_VARIANT;
+ while (i < (size - 1)) {
+ for (size_t j = 0; j < i; ++j)
+ CONTRACT_ASSERT_BLOCK_INVARIANT( result >= array[j] );
+ // -2 because start from 0 and already done element at 0.
+ CONTRACT_ASSERT_LOOP_VARIANT( size - i - 2 );
+
+ ++i;
+ result = std::max(result, array[i]);
+ }
+
+ return result;
+}) )
+
+int main() {
+ int a[] = {1, 5, 3};
+ std::cout << maxarray(a, 3) << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,40 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "stack3.hpp"
+#include <iostream>
+#include <string>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ stack3<std::string> s(3);
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << s.count() << std::endl;
+
+ std::cout << std::endl << "empty()" << std::endl;
+ std::cout << s.empty() << std::endl;
+
+ std::cout << std::endl << "full()" << std::endl;
+ std::cout << s.full() << std::endl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ s.put("Galileo");
+
+ std::cout << std::endl << "capacity()" << std::endl;
+ std::cout << s.capacity() << std::endl;
+
+ std::cout << std::endl << "item()" << std::endl;
+ std::cout << s.item() << std::endl;
+
+ std::cout << std::endl << "remove()" << std::endl;
+ s.remove();
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack3/stack3.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,185 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef STACK3_HPP_
+#define STACK3_HPP_
+
+#include "../stack4/stack4.hpp"
+#include <contract.hpp>
+
+/** Dispenser structures with a Last-In, First-Out access policy, and
+ * a fixed maximum capacity. Tolerant version setting an error code
+ * in case of impossible operations. */
+template<typename T>
+class stack3 {
+
+ CONTRACT_CLASS( (stack3) )
+
+public:
+ static const T DEFAULT_ITEM;
+
+ /** Error codes. */
+ enum Error {
+ NO_ERROR = 0,
+ OVERFLOW_ERROR,
+ UNDERFLOW_ERROR,
+ SIZE_ERROR,
+ };
+
+ // Initialization //
+
+ /** Create stack for a maximum of n elements. If n < 0, set error
+ * to SIZE_ERROR (but no precondition). */
+ stack3(const int& n): representation_(0), error_(NO_ERROR)
+ CONTRACT_CONSTRUCTOR(
+ (public) (stack3)( (const int&)(n) )
+ (postcondition) ({
+ CONTRACT_ASSERT( (n < 0) == (error() == SIZE_ERROR) );
+ CONTRACT_ASSERT( (n >= 0) == !error() );
+ if (!error()) CONTRACT_ASSERT( capacity() == n );
+ })
+ (body) ({
+ if (n >= 0) {
+ representation_ = stack4<T>(n);
+ } else {
+ error_ = SIZE_ERROR;
+ }
+ }) )
+
+ /** Destroy stack. */
+ virtual ~stack3(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (stack3)( (void) )
+ (body) ({
+ }) )
+
+ // Access //
+
+ /** Maximum number of stack elements. */
+ int capacity(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (capacity)( (void) ) (const)
+ (body) ({
+ return representation_.capacity();
+ }) )
+
+ /** Number of stack elements. */
+ int count(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (body) ({
+ return representation_.count();
+ }) )
+
+ /** Top element if present. Otherwise, return type's default
+ * value and set error to UNDERFLOW_ERROR (but no precondition). */
+ const T& item(void) const
+ CONTRACT_FUNCTION(
+ (public) (const T&) (item)( (void) ) (const)
+ (postcondition) (result) ({
+ // Const function so no need to user ODLOF(this)->empty().
+ CONTRACT_ASSERT( empty() == (error() == UNDERFLOW_ERROR) );
+ CONTRACT_ASSERT( !empty() == !error() );
+ })
+ (body) ({
+ if (!empty()) {
+ error_ = NO_ERROR;
+ return representation_.item();
+ } else {
+ error_ = UNDERFLOW_ERROR;
+ return DEFAULT_ITEM;
+ }
+ }) )
+
+ // Status Report //
+
+ /** Error indicator, set by various operators to a non-zero (not
+ * NO_ERROR) value if they cannot perform their job. */
+ Error error(void) const
+ CONTRACT_FUNCTION(
+ (public) (Error) (error)( (void) ) (const)
+ (body) ({
+ return error_;
+ }) )
+
+ /** Is stack has not item. */
+ bool empty(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (empty)( (void) ) (const)
+ (body) ({
+ return representation_.empty();
+ }) )
+
+ /** If stack cannot accept any more item. */
+ bool full(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (full)( (void) ) (const)
+ (body) ({
+ return representation_.full();
+ }) )
+
+ // Element Change //
+
+ /** Add x to top if there is capacity left. Otherwise, set error
+ * to OVERFLOW_ERROR (but no precondition). */
+ void put(const T& x)
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const T&)(x) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( CONTRACT_OLDOF(this)->full() ==
+ (error() == OVERFLOW_ERROR) );
+ CONTRACT_ASSERT( !CONTRACT_OLDOF(this)->full() ==
+ !error() );
+ if (!error()) CONTRACT_ASSERT( !empty() );
+ if (!error()) CONTRACT_ASSERT( item() == x );
+ if (!error()) CONTRACT_ASSERT(
+ count() == (CONTRACT_OLDOF(this)->count() + 1) );
+ })
+ (body) ({
+ if (full()) {
+ error_ = OVERFLOW_ERROR;
+ } else {
+ representation_.put(x);
+ error_ = NO_ERROR;
+ }
+ }) )
+
+ /** Remove element if present. Otherwise, set error to
+ * UNDERFLOW_ERROR (but no precondition) */
+ void remove(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (remove)( (void) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( CONTRACT_OLDOF(this)->empty() ==
+ (error() == UNDERFLOW_ERROR) );
+ CONTRACT_ASSERT( !CONTRACT_OLDOF(this)->empty() ==
+ !error() );
+ if (!error()) CONTRACT_ASSERT( !full() );
+ if (!error()) CONTRACT_ASSERT(
+ count() == (CONTRACT_OLDOF(this)->count() - 1) );
+ })
+ (body) ({
+ if (empty()) {
+ error_ = UNDERFLOW_ERROR;
+ } else {
+ representation_.remove();
+ error_ = NO_ERROR;
+ }
+ }) )
+
+private:
+ stack4<T> representation_;
+ // Mutable, changed by logically const members to report error.
+ mutable Error error_;
+};
+
+// For simplicity, T must have default constructor.
+template<typename T>
+const T stack3<T>::DEFAULT_ITEM = T();
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,40 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "stack4.hpp"
+#include <iostream>
+#include <string>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ stack4<std::string> s(3);
+
+ std::cout << std::endl << "capacity()" << std::endl;
+ std::cout << s.capacity() << std::endl;
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << s.count() << std::endl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ s.put("Galileo");
+
+ std::cout << std::endl << "empty()" << std::endl;
+ std::cout << s.empty() << std::endl;
+
+ std::cout << std::endl << "full()" << std::endl;
+ std::cout << s.full() << std::endl;
+
+ std::cout << std::endl << "item()" << std::endl;
+ std::cout << s.item() << std::endl;
+
+ std::cout << std::endl << "remove()" << std::endl;
+ s.remove();
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Meyer1997/stack4/stack4.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,228 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef STACK4_HPP_
+#define STACK4_HPP_
+
+#include <contract.hpp>
+
+// Specification //
+
+/** Dispenser structures with a Last-In, First-Out access policy,
+ * and a fixed maximum capacity. */
+template<typename T>
+class stack4 {
+
+ CONTRACT_CLASS( (stack4)
+ (invariant) ({
+ CONTRACT_ASSERT_MSG( representation_, "array allocated" );
+ CONTRACT_ASSERT( count() >= 0 );
+ CONTRACT_ASSERT( count() <= capacity() );
+ CONTRACT_ASSERT( empty() == (count() == 0) );
+ if (count() > 0) CONTRACT_ASSERT_MSG(
+ representation_[count() - 1] == item(),
+ "if positive, item at top" );
+ }) )
+
+public:
+ // Initialization //
+
+ /** Create stack for a maximum of n elements. */
+ stack4(const int& n): capacity_(0), count_(0), representation_()
+ CONTRACT_CONSTRUCTOR(
+ (public) (stack4)( (const int&)(n) )
+ (precondition) ({
+ CONTRACT_ASSERT( n >= 0 );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( capacity() == n );
+ CONTRACT_ASSERT( empty() );
+ })
+ (body) (
+ ;
+ ) )
+
+ /** Deep copy. */
+ stack4(const stack4& other): capacity_(other.capacity_),
+ count_(other.count_),
+ representation_(new T[other.capacity_])
+ CONTRACT_CONSTRUCTOR(
+ (public) (stack4)( (const stack4&)(other) )
+ (body) (
+ ;
+ ) )
+
+ /** Deep assignment. */
+ stack4& operator=(const stack4& other)
+ CONTRACT_FUNCTION(
+ (public) (stack4&) (operator(=, assign))(
+ (const stack4&)(other) )
+ (body) (
+ ;
+ ) )
+
+ /** Destroy this stack. */
+ virtual ~stack4(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (stack4)( (void) )
+ (body) (
+ ;
+ ) )
+
+ // Access //
+
+ /** Maximum number of stack elements. */
+ int capacity(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (capacity)( (void) ) (const)
+ (body) (
+ ;
+ ) )
+
+ /** Number of stack elements. */
+ int count(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (body) (
+ ;
+ ) )
+
+ /** Top element. */
+ const T& item(void) const
+ CONTRACT_FUNCTION(
+ (public) (const T&) (item)( (void) ) (const)
+ (body) (
+ ;
+ ) )
+
+ // Status Report //
+
+ /** If stack is empty. */
+ bool empty(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (empty)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == (count() == 0) );
+ })
+ (body) (
+ ;
+ ) )
+
+ /** If stack is full. */
+ bool full(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (full)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == (count() == capacity()) );
+ })
+ (body) (
+ ;
+ ) )
+
+ // Element Change //
+
+ /** Add x on top. */
+ void put(const T& x)
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const T&)(x) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( !full() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( !empty() );
+ CONTRACT_ASSERT_MSG( item() == x, "added to top" );
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() + 1) );
+ CONTRACT_ASSERT_MSG( representation_[count() - 1] == x,
+ "at top array entry" );
+ })
+ (body) (
+ ;
+ ) )
+
+ /** Remove top item. */
+ void remove(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (remove)( (void) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( !empty() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( !full() );
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() - 1) );
+ })
+ (body) (
+ ;
+ ) )
+
+private:
+ int capacity_;
+ int count_;
+ T* representation_; // C-style array.
+};
+
+// Implementation //
+
+template<typename T>
+CONTRACT_CONSTRUCTOR_BODY(stack4<T>, stack4)(const int& n) {
+ capacity_ = n;
+ representation_ = new T[n];
+}
+
+template<typename T>
+CONTRACT_CONSTRUCTOR_BODY(stack4<T>, stack4)(const stack4& other) {
+ for (int i = 0; i < other.count_; ++i) {
+ representation_[i] = other.representation_[i];
+ }
+}
+
+template<typename T>
+stack4<T>& stack4<T>::CONTRACT_BODY(operator(=, assign))(
+ const stack4& other) {
+ delete[] representation_;
+ capacity_ = other.capacity_;
+ count_ = other.count_;
+ representation_ = new T[other.capacity_];
+ for (int i = 0; i < other.count_; ++i) {
+ representation_[i] = other.representation_[i];
+ }
+ return *this;
+}
+
+template<typename T>
+CONTRACT_DESTRUCTOR_BODY(stack4<T>, ~stack4)(void)
+ { delete[] representation_; }
+
+template<typename T>
+int stack4<T>::CONTRACT_BODY(capacity)(void) const
+ { return capacity_; }
+
+template<typename T>
+int stack4<T>::CONTRACT_BODY(count)(void) const { return count_; }
+
+template<typename T>
+const T& stack4<T>::CONTRACT_BODY(item)(void) const
+ { return representation_[count() - 1]; }
+
+template<typename T>
+bool stack4<T>::CONTRACT_BODY(empty)(void) const
+ { return count() == 0; }
+
+template<typename T>
+bool stack4<T>::CONTRACT_BODY(full)(void) const
+ { return count() == capacity(); }
+
+template<typename T>
+void stack4<T>::CONTRACT_BODY(put)(const T& x)
+ { representation_[count_++] = x; }
+
+template<typename T>
+void stack4<T>::CONTRACT_BODY(remove)(void) { --count_; }
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,2 @@
+Examples of contracts mainly ported from Eiffel.
+Adapted from book "Design by Contract, by Example", 2002.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/counter.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,63 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef COUNTER_HPP_
+#define COUNTER_HPP_
+
+#include "../observer/subject.hpp"
+#include <contract.hpp>
+
+/** Positive integer counter. */
+class counter: public subject {
+
+ CONTRACT_CLASS( (counter) (subject) )
+
+public:
+ // Creation //
+
+ /** Construct counter. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (counter)( (const int&) (value) (default)(10) )
+ (value_(value))
+ ({
+ }) )
+
+ /** Destroy counter. */
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (counter)( (void) )
+ ({
+ }) )
+
+ // Queries //
+
+ /** Counter current value. */
+ CONTRACT_FUNCTION(
+ (public) (int) (value)( (void) ) (const)
+ ({
+ return value_;
+ }) )
+
+ // Commands //
+
+ /** Decrement counter value. */
+ CONTRACT_FUNCTION(
+ (public) (void) (decrement)( (void) ) (copyable)
+ (postcondition)(
+ (value() ==
+ (CONTRACT_OLDOF(this)->value() - 1))
+ )
+ ({
+ --value_;
+ notify(); // Notifies all attached observers.
+ }) )
+
+private:
+ int value_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/decrement_button.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,115 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef DECREMENT_BUTTON_HPP_
+#define DECREMENT_BUTTON_HPP_
+
+#include "push_button.hpp"
+#include "counter.hpp"
+#include "../observer/observer.hpp"
+#include <contract.hpp>
+#include <boost/utility.hpp>
+
+class decrement_button: public push_button, protected observer,
+ // This class is non-copyable but postconditions can still
+ // access its old values (see below).
+ boost::noncopyable {
+
+ CONTRACT_CLASS( (decrement_button) (push_button) (observer) )
+
+public:
+ // Creation //
+
+ /** Create button associated with given counter. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (decrement_button)( (counter&)(the_counter) )
+ (counter_ref_(the_counter))
+ (postcondition)( (enabled() == (the_counter.value() > 0)) )
+ ({
+ counter_ref_.attach(this);
+ }) )
+
+ /** Destroy button. */
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (decrement_button)( (void) )
+ ({
+ }) )
+
+ // Commands //
+
+ CONTRACT_FUNCTION(
+ (public) (void) (on_bn_clicked)( (void) ) (copyable)
+ (precondition)( (enabled()) )
+ (postcondition)(
+ (counter_ref_.value() ==
+ (CONTRACT_OLDOF(this)->counter_ref_.value() - 1))
+ )
+ ({
+ counter_ref_.decrement();
+ }) )
+
+private:
+ decrement_button& operator=(const decrement_button&); // Hide.
+
+ CONTRACT_FUNCTION(
+ (private) (bool) (up_to_date_with_subject)( (void) ) (const)
+ ({
+ return true; // For simplicity, always return true.
+ }) )
+
+ CONTRACT_FUNCTION(
+ (private) (void) (update)( (void) )
+ (postcondition) (
+ (enabled() == (counter_ref_.value() > 0))
+ )
+ ({
+ if (0 == counter_ref_.value()) disable();
+ else enable();
+ }) )
+
+ counter& counter_ref_;
+
+ // Allow access to contracts to implement special "copy".
+ friend class contract::copy<decrement_button>;
+};
+
+// WARNING: Specialize `contract::copy` with care and only if really
+// necessary (as a wrongly implemented specialization could brake
+// contract constant-correctness guarantees).
+//
+// The decrement_button class has a reference member. The referenced
+// counter (and not the counter reference!) are copied here to support
+// object old value semantics in contract preconditions. This special
+// "copy" is for contracts only -- in fact, decrement_button is
+// `boost::noncopyable` and cannot be copied for general purposes.
+//
+// Similar techniques can be used to handle copy of objects with
+// member pointers, in which case the `contract::copy` constructor
+// allocates and copies the pointed objects (and not the pointers!)
+// and the destructor deallocates them.
+namespace contract {
+
+template<>
+class copy<decrement_button> {
+private:
+ // Not a reference type so it is copied.
+ counter counter_; // Non-const but local to this class.
+public:
+ const decrement_button value;
+
+ copy(const decrement_button& source):
+ // Copy the referenced counter (not the reference).
+ counter_(source.counter_ref_),
+ // "Copy" decrement_button constructing one from
+ // the copied counter.
+ value(counter_) {}
+};
+
+} // namespace
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,40 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "counter.hpp"
+#include "decrement_button.hpp"
+#include "view_of_counter.hpp"
+#include <iostream>
+
+int main() {
+ counter cnt(3);
+ view_of_counter view(cnt);
+ decrement_button dec(cnt);
+
+ // Simple text-based menu selection.
+ char ch = '\0';
+ while (ch != 'q') {
+ if (dec.enabled()) {
+ std::cout << "(-) Decrement counter" << std::endl;
+ }
+ std::cout << "(q) Quit" << std::endl;
+ std::cout << "Select: ";
+
+ std::cin >> ch;
+ if ('q' == ch) {
+ return 0;
+ } else if ('-' == ch && dec.enabled()) {
+ dec.on_bn_clicked();
+ } else {
+ std::cout << "Invalid selection '" << ch << "'"
+ << std::endl;
+ }
+ }
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/push_button.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,71 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef PUSH_BUTTON_HPP_
+#define PUSH_BUTTON_HPP_
+
+#include <contract.hpp>
+
+/** Basic button. */
+class push_button {
+
+ CONTRACT_CLASS( (push_button) )
+
+public:
+ // Creation //
+
+ /** Create button. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (push_button)( (void) ) (enabled_(true))
+ ({
+ }) )
+
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (push_button)( (void) )
+ ({
+ }) )
+
+ // Queries //
+
+ /** If button enabled. */
+ CONTRACT_FUNCTION(
+ (public) (bool) (enabled)( (void) ) (const)
+ ({
+ return enabled_;
+ }) )
+
+ // Commands //
+
+ /** Enable this button. */
+ CONTRACT_FUNCTION(
+ (public) (void) (enable)( (void) )
+ (postcondition)( (enabled()) )
+ ({
+ enabled_ = true;
+ }) )
+
+ /** Disable this button. */
+ CONTRACT_FUNCTION(
+ (public) (void) (disable)( (void) )
+ (postcondition)( (bool(!enabled())) )
+ ({
+ enabled_ = false;
+ }) )
+
+ /** Invoked externally when this button is clicked. */
+ CONTRACT_FUNCTION(
+ (public) (virtual) (void) (on_bn_clicked)( (void) )
+ (
+ = 0;
+ ) )
+
+private:
+ bool enabled_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/counter/view_of_counter.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,52 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef VIEW_OF_COUNT_HPP_
+#define VIEW_OF_COUNT_HPP_
+
+#include "../observer/observer.hpp"
+#include "counter.hpp"
+#include <contract.hpp>
+#include <iostream> // To view counter value on console.
+
+/** Show current value of associated counter. */
+class view_of_counter: private observer {
+
+ CONTRACT_CLASS( (view_of_counter) (observer) )
+
+public:
+ // Creation //
+
+ /** Create viewer associated with given counter. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (view_of_counter)( (counter&)(the_counter) )
+ (counter_ref_(the_counter))
+ ({
+ counter_ref_.attach(this);
+ std::cout << std::endl << ">> Counter started at "
+ << counter_ref_.value() << std::endl << std::endl;
+ }) )
+
+private:
+ CONTRACT_FUNCTION(
+ (private) (bool) (up_to_date_with_subject)( (void) ) (const)
+ ({
+ return true; // For simplicity, always return true.
+ }) )
+
+ CONTRACT_FUNCTION(
+ (private) (void) (update)( (void) )
+ ({
+ std::cout << std::endl << ">> Counter changed to "
+ << counter_ref_.value() << std::endl << std::endl;
+ }) )
+
+ counter& counter_ref_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,45 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "couriers.hpp"
+#include <contract.hpp>
+
+// Courier //
+
+double courier::MIN_INSURANCE_DOLLAR = 10.0e+6;
+
+CONTRACT_CONSTRUCTOR_BODY(courier, courier)(
+ const double& insurance_cover_dollar) {
+ insurance_cover_dollar_ = insurance_cover_dollar;
+}
+
+CONTRACT_DESTRUCTOR_BODY(courier, courier)(void) {}
+
+double courier::CONTRACT_MEMBER_BODY(insurance_cover_dollar)(void) const {
+ return insurance_cover_dollar_;
+}
+
+void courier::CONTRACT_MEMBER_BODY(deliver)(package& the_package,
+ const std::string& destination) {
+ the_package.location = destination;
+ // Delivery takes 2.5 hours.
+ the_package.delivered_hour = the_package.accepted_hour + 2.5;
+}
+
+// Different Courier //
+
+double different_courier::DIFFERENT_INSURANCE_DOLLAR = 20.0e+6;
+
+CONTRACT_DESTRUCTOR_BODY(different_courier, different_courier)(void) {}
+
+void different_courier::CONTRACT_MEMBER_BODY(deliver)(package& the_package,
+ const std::string& destination) {
+ the_package.location = destination;
+ // Delivery takes only 0.5 hours.
+ the_package.delivered_hour = the_package.accepted_hour + 0.5;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/couriers.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,159 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef COURIERS_HPP_
+#define COURIERS_HPP_
+
+#include <contract.hpp>
+#include <string>
+
+/** Basic package information. */
+struct package {
+ /** Weight in kilograms. */
+ double weight_kg;
+ /** Current location. */
+ std::string location;
+ /** Hour when it was accepted for delivery (from some 0-hour). */
+ double accepted_hour;
+ /** Hour when was delivered (from some 0-hour). */
+ double delivered_hour;
+
+ package(const double& the_weight_kg,
+ const std::string the_location = "",
+ const double& the_accepted_hour = 0.0,
+ const double& the_delivered_hour = 0.0):
+ weight_kg(the_weight_kg),
+ location(the_location),
+ accepted_hour(the_accepted_hour),
+ delivered_hour(the_delivered_hour)
+ {}
+};
+
+/** Basic courier for package delivery. */
+class courier {
+
+ CONTRACT_CLASS( (courier)
+ (static)(invariant)(
+ (MIN_INSURANCE_DOLLAR > 0.0)
+ )
+ (invariant)(
+ (insurance_cover_dollar() >= MIN_INSURANCE_DOLLAR)
+ ) )
+
+public:
+ static double MIN_INSURANCE_DOLLAR;
+
+ // Creation //
+
+ /** Create courier with specified insurance value. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (courier)(
+ (const double&)(insurance_cover_dollar)
+ (default)(MIN_INSURANCE_DOLLAR)
+ )
+ (precondition)( (insurance_cover_dollar > 0.0) )
+ (
+ ;
+ ) )
+
+ /** Destroy courier. */
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (courier)( (void) )
+ (
+ ;
+ ) )
+
+ // Queries //
+
+ /** Return insurance cover. */
+ CONTRACT_FUNCTION(
+ (public) (double) (insurance_cover_dollar)( (void) ) (const)
+ (
+ ;
+ ) )
+
+ // Commands //
+
+ /** Deliver package to destination. */
+ CONTRACT_FUNCTION(
+ (public) (virtual) (void) (deliver)(
+ (package&)(the_package)
+ (const std::string&)(destination)
+ )
+ (precondition)( (the_package.weight_kg <= 5.0) ) // Max weight.
+ (postcondition)(
+ (bool(3.0 >= (the_package.delivered_hour -
+ the_package.accepted_hour))) // Max delivery time.
+ (the_package.location == destination) // Delivered at destination.
+ )
+ (
+ ;
+ ) )
+
+private:
+ double insurance_cover_dollar_;
+};
+
+/** Different courier for package delivery. */
+class different_courier: public courier {
+
+ CONTRACT_CLASS( (different_courier) (courier)
+ (static)(invariant)(
+ // Stronger invariant on insurance value (higher amount).
+ (DIFFERENT_INSURANCE_DOLLAR >= courier::MIN_INSURANCE_DOLLAR)
+ )
+ (invariant)(
+ (insurance_cover_dollar() >= DIFFERENT_INSURANCE_DOLLAR)
+ ) )
+
+public:
+ static double DIFFERENT_INSURANCE_DOLLAR;
+
+ // Creation //
+
+ /** Create courier with specified insurance value. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (different_courier)(
+ (const double&)(insurance_cover_dollar)
+ (default)(DIFFERENT_INSURANCE_DOLLAR)
+ ) (courier(insurance_cover_dollar))
+ (precondition)( (insurance_cover_dollar >= 0.0) )
+ ({
+ // Cannot separate definition because has member (base) initialization.
+ }) )
+
+ /** Destroy courier. */
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (different_courier)( (void) )
+ (
+ ;
+ ) )
+
+ // Commands //
+
+ CONTRACT_FUNCTION(
+ (public) (virtual) (void) (deliver)(
+ (package&)(the_package)
+ (const std::string&)(destination)
+ )
+ (precondition)(
+ // Weaker precondition on weight (can weight more).
+ (the_package.weight_kg <= 8.0)
+ )
+ (postcondition)(
+ // Stronger postcondition on deliver time (faster deliver).
+ (bool(2.0 >= (the_package.delivered_hour -
+ the_package.accepted_hour)))
+ // Inherits "delivered at destination" postcondition.
+ )
+ (
+ ;
+ ) )
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/courier/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,36 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "couriers.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "courier constructor" << std::endl;
+ courier c;
+ {
+ std::cout << std::endl << "different courier constructor"
+ << std::endl;
+ different_courier dc;
+
+ package cups(3.6, "store");
+ package desk(7.2, "store");
+
+ std::cout << std::endl << "courier delivers cups home"
+ << std::endl;
+ c.deliver(cups, "home");
+
+ std::cout << std::endl << "different courier delivers desk "
+ << "to office" << std::endl;
+ dc.deliver(desk, "office");
+
+ std::cout << std::endl << "different courier destructor"
+ << std::endl;
+ }
+ std::cout << std::endl << "courier destructor" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,42 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "customer_manager.hpp"
+#include <contract.hpp>
+
+CONTRACT_CONSTRUCTOR_BODY(customer_manager, customer_manager)(void) {}
+
+CONTRACT_DESTRUCTOR_BODY(customer_manager, customer_manager)(void) {}
+
+int customer_manager::CONTRACT_MEMBER_BODY(count)(void) const {
+ return customers_.size();
+}
+
+bool customer_manager::CONTRACT_MEMBER_BODY(id_active)(
+ const basic_customer_details::identifier& id) const {
+ return customers_.find(id) != customers_.end();
+}
+
+const std::string& customer_manager::CONTRACT_MEMBER_BODY(name_for)(
+ const basic_customer_details::identifier& id) const {
+ // Find != end() because of id_active() precondition.
+ return customers_.find(id)->second.name;
+}
+
+void customer_manager::CONTRACT_MEMBER_BODY(add)(
+ const basic_customer_details& details) {
+ customers_.insert(std::pair<basic_customer_details::identifier,
+ customer>(details.id, customer(details)));
+}
+
+void customer_manager::CONTRACT_MEMBER_BODY(set_name)(
+ const basic_customer_details::identifier& id,
+ const std::string& name) {
+ // Find != end() because of id_active() precondition.
+ customers_.find(id)->second.name = name;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/customer_manager.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,140 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef CUSTOMER_MANAGE_HPP_
+#define CUSTOMER_MANAGE_HPP_
+
+#include <contract.hpp>
+#include <string>
+#include <map>
+
+/** Basic customer information. */
+class basic_customer_details {
+ friend class customer_manager;
+
+public:
+ /** Identifier type. */
+ typedef std::string identifier;
+
+ /** Construct basic customer information. */
+ explicit basic_customer_details(const identifier& the_id):
+ id(the_id), name(), address(), birthday() {}
+
+protected:
+ /** Customer identifier. */
+ identifier id;
+ /** Customer name. */
+ std::string name;
+ /** Customer address. */
+ std::string address;
+ /** Customer date of birth. */
+ std::string birthday;
+};
+
+/** Manage customers. */
+class customer_manager {
+
+ CONTRACT_CLASS( (customer_manager)
+ (invariant)(
+ (count() >= 0)
+ ) )
+
+public:
+ // Construction //
+
+ CONTRACT_CONSTRUCTOR(
+ (public) (customer_manager)( (void) )
+ // Cannot use member initializers here because separating definition.
+ (
+ ;
+ ) )
+
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (customer_manager)( (void) )
+ (
+ ;
+ ) )
+
+ // Basic Queries //
+
+ /** Number of customers. */
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (postcondition)(result)( (result >= 0) )
+ (
+ ;
+ ) )
+
+ /** There is a customer with given identifier. */
+ CONTRACT_FUNCTION(
+ (public) (bool) (id_active)(
+ (const basic_customer_details::identifier&)(id)
+ ) (const)
+ (
+ ;
+ ) )
+
+ // Derived Queries //
+
+ /** Name of customer with given identifier. */
+ CONTRACT_FUNCTION(
+ (public) (const std::string&) (name_for)(
+ (const basic_customer_details::identifier&)(id)
+ ) (const)
+ (precondition)( (id_active(id)) )
+ (
+ ;
+ ) )
+
+ // Commands //
+
+ /** Add given customer. */
+ CONTRACT_FUNCTION(
+ (public) (void) (add)( (const basic_customer_details&)(details) ) (copyable)
+ (precondition)( (id_active(details.id) == false) )
+ (postcondition)(
+ (count() == (CONTRACT_OLDOF(this)->count() + 1))
+ (id_active(details.id))
+ )
+ (
+ ;
+ ) )
+
+ /** Set name of customer with given identifier. */
+ CONTRACT_FUNCTION(
+ (public) (void) (set_name)(
+ (const basic_customer_details::identifier&)(id)
+ (const std::string&)(name)
+ )
+ (precondition)( (id_active(id)) )
+ (postcondition)( (name_for(id) == name) )
+ (
+ ;
+ ) )
+
+private:
+ /** Customer agent. */
+ class agent {};
+
+ /** Basic customer. */
+ class customer: public basic_customer_details {
+ public:
+ /** Customer agent/ */
+ agent managing_agent;
+ /** Customer last contacted. */
+ std::string last_contact;
+
+ explicit customer(const basic_customer_details& details):
+ basic_customer_details(details), managing_agent(),
+ last_contact() {}
+ };
+
+ std::map<basic_customer_details::identifier, customer> customers_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/customer_manager/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,34 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "customer_manager.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << "constructor()" << std::endl;
+ customer_manager mgr;
+
+ basic_customer_details d("sci");
+ std::cout << std::endl << "add()" << std::endl;
+ mgr.add(d);
+
+ std::cout << std::endl << "set_name()" << std::endl;
+ mgr.set_name("sci", "Galileo");
+
+ std::cout << std::endl << "name_for()" << std::endl;
+ std::cout << mgr.name_for("sci");
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << mgr.count() << std::endl;
+
+ std::cout << std::endl << "id_active()" << std::endl;
+ std::cout << mgr.id_active("sci") << std::endl;
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/dictionary.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,118 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef DICTINARY_HPP_
+#define DICTINARY_HPP_
+
+#include <contract.hpp>
+#include <map>
+
+/** Simple dictionary. */
+template<typename Key, typename Value>
+class dictionary {
+
+ CONTRACT_CLASS( (dictionary)
+ (invariant) ({
+ CONTRACT_ASSERT( count() >= 0 );
+ }) )
+
+public:
+ // Creation //
+
+ /** Create empty dictionary. */
+ dictionary(void)
+ CONTRACT_CONSTRUCTOR(
+ (public) (dictionary)( (void) )
+ (postcondition) ({
+ CONTRACT_ASSERT( 0 == count() );
+ })
+ (body) ({
+ }) )
+
+ /** Destroy dictionary. */
+ virtual ~dictionary(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (dictionary)( (void) )
+ (body) ({
+ }) )
+
+ // Basic Queries //
+
+ /** Number of key entries. */
+ int count(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result >= 0 );
+ })
+ (body) ({
+ return items_.size();
+ }) )
+
+ /** If there is an entry for specified key. */
+ bool has(const Key& key) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (has)( (const Key&)(key) ) (const)
+ (postcondition) (result) ({
+ if (count() == 0) CONTRACT_ASSERT( result == false );
+ })
+ (body) ({
+ return items_.find(key) != items_.end();
+
+ }) )
+
+ /** Value for given key. */
+ const Value& value_for(const Key& key) const
+ CONTRACT_FUNCTION(
+ (public) (const Value&) (value_for)( (const Key&)(key) )
+ (const)
+ (precondition) ({
+ CONTRACT_ASSERT( has(key) );
+ })
+ (body) ({
+ return items_.find(key)->second;
+ }) )
+
+ // Commands //
+
+ /** Put value for given key. */
+ void put(const Key& key, const Value& value)
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const Key&)(key)
+ (const Value&)(value) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() + 1) );
+ CONTRACT_ASSERT( has(key) );
+ CONTRACT_ASSERT( value_for(key) == value );
+ })
+ (body) ({
+ items_.insert(std::pair<Key, Value>(key, value));
+ }) )
+
+ /** Remove value for given key. */
+ void remove(const Key& key)
+ CONTRACT_FUNCTION(
+ (public) (void) (remove)( (const Key&)(key) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( has(key) );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() - 1) );
+ CONTRACT_ASSERT( !has(key) );
+ })
+ (body) ({
+ items_.erase(key);
+ }) )
+
+private:
+ std::map<Key, Value> items_;
+};
+
+#endif // #inlcude guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/dictionary/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,34 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "dictionary.hpp"
+#include <string>
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ dictionary<std::string, int> ages;
+
+ std::cout << std::endl << "has()" << std::endl;
+ std::cout << ages.has("Galileo") << std::endl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ ages.put("Galileo", 78);
+
+ std::cout << std::endl << "value_for()" << std::endl;
+ std::cout << ages.value_for("Galileo") << std::endl;
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << ages.count() << std::endl;
+
+ std::cout << std::endl << "remove()" << std::endl;
+ ages.remove("Galileo");
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,30 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "names.hpp"
+
+int main() {
+ std::string n = "Galileo";
+
+ std::cout << std::endl << "constructor()" << std::endl;
+ name_list nl;
+ relaxed_name_list rl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ rl.put(n);
+ std::cout << std::endl << "put() again (allowed)" << std::endl;
+ rl.put(n);
+
+ std::cout << std::endl << "put()" << std::endl;
+ nl.put(n);
+ std::cout << std::endl << "put() again (not allowed)" << std::endl;
+ nl.put(n);
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,47 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "names.hpp"
+#include <contract.hpp>
+#include <algorithm>
+
+// name_list //
+
+CONTRACT_CONSTRUCTOR_BODY(name_list, name_list)(void) {}
+
+CONTRACT_DESTRUCTOR_BODY(name_list, name_list)(void) {}
+
+bool name_list::CONTRACT_MEMBER_BODY(has)(const std::string& name) const {
+ std::clog << "base has\n";
+ return names_.end() != std::find(names_.begin(), names_.end(), name);
+}
+
+unsigned int name_list::CONTRACT_MEMBER_BODY(count)(void) const {
+ std::clog << "base count\n";
+ return names_.size();
+}
+
+void name_list::CONTRACT_MEMBER_BODY(put)(const std::string& name) {
+ std::clog << "base put\n";
+ names_.push_back(name);
+}
+
+// relaxed_name_list //
+
+CONTRACT_CONSTRUCTOR_BODY(relaxed_name_list, relaxed_name_list)(void) {}
+
+CONTRACT_DESTRUCTOR_BODY(relaxed_name_list, relaxed_name_list)(void) {}
+
+void relaxed_name_list::CONTRACT_MEMBER_BODY(put)(const std::string& name) {
+ std::clog << "dervied put\n";
+ if (!has(name)) {
+ // Base class operations must be called via BODY macro.
+ name_list::CONTRACT_MEMBER_BODY(put)(name);
+ // name_list::put(name); // ERROR: causes infinite recursion.
+ }
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/name_list/names.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,115 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef NAMES_HPP_
+#define NAMES_HPP_
+
+#include <contract.hpp>
+#include <string>
+#include <list>
+
+/** List of names. */
+class name_list {
+
+ CONTRACT_CLASS( (name_list) )
+
+public:
+ // Creation //
+
+ /** Create object. */
+ CONTRACT_CONSTRUCTOR(
+ (public) (name_list)( (void) )
+ (
+ ;
+ ) )
+
+ /** Destroy object. */
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (name_list)( (void) )
+ (
+ ;
+ ) )
+
+ // Queries //
+
+ /** If specified names is in list. */
+ CONTRACT_FUNCTION(
+ (public) (bool) (has)( (const std::string&)(name) ) (const)
+ (
+ ;
+ ) )
+
+ /** Number of names in list. */
+ CONTRACT_FUNCTION(
+ (public) (unsigned int) (count)( (void) ) (const)
+ (
+ ;
+ ) )
+
+ // Commands //
+
+ /** Add name to list. */
+ CONTRACT_FUNCTION(
+ (public) (virtual) (void) (put)( (const std::string&)(name) ) (copyable)
+ (precondition)( (has(name) == false) )
+ (postcondition)(
+ // If-guard allows subcontracts to relax postconditions.
+ (if (!CONTRACT_OLDOF(this)->has(name)) (
+ (has(name))
+ (count() == (CONTRACT_OLDOF(this)->count() + 1))
+ ) )
+ )
+ (
+ ;
+ ) )
+
+private:
+ std::list<std::string> names_;
+};
+
+/** List of names that allows for duplicates. */
+class relaxed_name_list: public name_list {
+
+ // Subcontract from `name_list`.
+ CONTRACT_CLASS( (relaxed_name_list) (name_list) )
+
+public:
+ // Creation //
+
+ CONTRACT_CONSTRUCTOR(
+ (public) (relaxed_name_list)( (void) )
+ (
+ ;
+ ) )
+
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (relaxed_name_list)( (void) )
+ (
+ ;
+ ) )
+
+ // Commands //
+
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const std::string&)(name) ) (copyable)
+ (precondition)(
+ // Relax inherited precondition `has(name) == false`.
+ (has(name))
+ )
+ (postcondition)(
+ // Inherited postcondition not checked because of its if-guard.
+ (if (CONTRACT_OLDOF(this)->has(name)) (
+ (count() == CONTRACT_OLDOF(this)->count())
+ ) )
+ )
+ (
+ ;
+ ) )
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,85 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "observe.hpp"
+#include <contract.hpp>
+#include <iostream>
+
+/** Implement an actual subject. */
+class concrete_subject: public subject {
+public:
+ /** State being observed. */
+ typedef int state;
+
+ concrete_subject(): state_() {}
+
+ /** Set state being observed. */
+ void set_state(const state& the_state) {
+ std::cout << "Changing state to " << the_state << std::endl;
+ state_ = the_state;
+ notify(); // Notify observers.
+ }
+
+ /** Get state being observed. */
+ state get_state() const { return state_; }
+
+private:
+ state state_;
+};
+
+/** Implement of actual observer. */
+class concrete_observer: public observer {
+
+ CONTRACT_CLASS( (concrete_observer) (observer) )
+
+public:
+ /** Create concrete observer. */
+ concrete_observer(const concrete_subject& the_subject):
+ subject_(the_subject), observed_state_() {}
+
+private:
+ bool up_to_date_with_subject(void) const
+ CONTRACT_FUNCTION(
+ (private) (bool) (up_to_date_with_subject)( (void) ) (const)
+ (body) ({
+ return true; // For simplicity, always true.
+ }) )
+
+ void update(void)
+ CONTRACT_FUNCTION(
+ (private) (void) (update)( (void) )
+ (body) ({
+ observed_state_ = subject_.get_state();
+ std::cout << "Observed state " << observed_state_
+ << std::endl;
+ }) )
+
+ const concrete_subject& subject_;
+ concrete_subject::state observed_state_;
+};
+
+int main() {
+ std::cout << std::endl << "Constructing objects" << std::endl;
+ concrete_subject sbj;
+ concrete_observer ob(sbj);
+
+ std::cout << std::endl << "Attaching observer " << &ob
+ << std::endl;
+ sbj.attach(&ob);
+
+ concrete_subject::state st = -10;
+ std::cout << std::endl << "Setting state to " << st << std::endl;
+ sbj.set_state(st);
+
+ st = +10;
+ std::cout << std::endl << "Re-setting state to " << st << std::endl;
+ sbj.set_state(st);
+
+ std::cout << std::endl << "Destructing objects" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/observe/observe.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,184 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef OBSERVE_HPP_
+#define OBSERVE_HPP_
+
+#include <contract.hpp>
+#include <list>
+#include <algorithm>
+
+/** Observer. */
+class observer {
+ friend class subject;
+
+ CONTRACT_CLASS( (observer) )
+
+public:
+ // Creation //
+
+ /** Create observer. */
+ observer(void)
+ CONTRACT_CONSTRUCTOR(
+ (public) (observer)( (void) )
+ (body) ({
+ }) )
+
+ /** Destroy observer. */
+ virtual ~observer(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (observer)( (void) )
+ (body) ({
+ }) )
+
+protected:
+ // Commands //
+
+ /** If up to date with its subject. */
+ virtual bool up_to_date_with_subject(void) const
+ CONTRACT_FUNCTION(
+ (protected) (virtual) (bool) (up_to_date_with_subject)(
+ (void) ) (const)
+ (body) (
+ = 0;
+ ) )
+
+ virtual void update(void)
+ CONTRACT_FUNCTION(
+ (protected) (virtual) (void) (update)( (void) )
+ (postcondition) ({
+ CONTRACT_ASSERT( up_to_date_with_subject() );
+ })
+ (body) (
+ = 0;
+ ) )
+};
+
+/** Subject for observer design pattern. */
+class subject {
+
+ CONTRACT_CLASS( (subject)
+ (invariant) ({
+ for (std::list<observer*>::const_iterator
+ i = observers_.begin(); i != observers_.end(); ++i)
+ CONTRACT_ASSERT( *i );
+ }) )
+
+public:
+ // Creation //
+
+ /** Construct subject. */
+ subject(void): observers_()
+ CONTRACT_CONSTRUCTOR(
+ (public) (subject)( (void) )
+ (body) ({
+ }) )
+
+ /** Destroy subject. */
+ virtual ~subject(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (subject)( (void) )
+ (body) ({
+ }) )
+
+ // Queries //
+
+ /** If given observer is attached. */
+ bool attached(const observer* const ob) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (attached)( (const observer* const)(ob) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( ob );
+ })
+ (postcondition) (result) ({
+ const std::list<const observer*> obs = observers();
+ CONTRACT_ASSERT( result == (std::find(obs.begin(), obs.end(),
+ ob) != obs.end()) );
+ })
+ (body) ({
+ return std::find(observers_.begin(), observers_.end(),
+ ob) != observers_.end();
+ }) )
+
+ // Commands //
+
+ /** Remember given objects as on of the subject observers. */
+ void attach(observer* const ob)
+ CONTRACT_FUNCTION(
+ (public) (void) (attach)( (observer* const)(ob) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( ob );
+ CONTRACT_ASSERT( !attached(ob) );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( attached(ob) );
+
+ // Frame rule.
+ const std::list<const observer*>& old =
+ CONTRACT_OLDOF(this)->observers();
+ std::list<const observer*> now = observers();
+ std::remove(now.begin(), now.end(), ob);
+ std::list<const observer*>::const_iterator nowi = now.begin();
+ std::list<const observer*>::const_iterator oldi = old.begin();
+ while (now.end() != nowi && old.end() != oldi) {
+ CONTRACT_ASSERT_MSG( *nowi == *oldi,
+ "all other observers unchanged" );
+ ++nowi;
+ ++oldi;
+ }
+ })
+ (body) ({
+ observers_.push_back(ob);
+ }) )
+
+protected:
+ // Queries //
+
+ /** All observers attached to this subject.
+ * This is protected because it is intended to support contract
+ * specification only (including contracts of derived classes).
+ * See related discussion in [Mitchell2002] Section 9.9. */
+ std::list<const observer*> observers(void) const
+ CONTRACT_FUNCTION(
+ (protected) (std::list<const observer*>) (observers)(
+ (void) ) (const)
+ (body) ({
+ // Create list of pointers to const observers.
+ std::list<const observer*> obs;
+ for (std::list<observer*>::const_iterator
+ i = observers_.begin(); i != observers_.end(); ++i)
+ obs.push_back(*i);
+ return obs;
+ }) )
+
+ // Commands //
+
+ /** Update all attached observers. */
+ void notify(void)
+ CONTRACT_FUNCTION(
+ (protected) (void) (notify)( (void) )
+ (postcondition) ({
+ const std::list<const observer*> obs = observers();
+ for (std::list<const observer*>::const_iterator
+ i = obs.begin(); i != obs.end(); ++i) {
+ CONTRACT_ASSERT( *i );
+ CONTRACT_ASSERT( (*i)->up_to_date_with_subject() );
+ }
+ })
+ (body) ({
+ for (std::list<observer*>::iterator
+ i = observers_.begin(); i != observers_.end(); ++i)
+ // Invariant ensures no null pointers in observers.
+ (*i)->update();
+ }) )
+
+private:
+ std::list<observer*> observers_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "simple_queue.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ simple_queue<char> q(10);
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << q.count() << std::endl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ q.put('a');
+ std::cout << std::endl << "put() (again)" << std::endl;
+ q.put('b');
+
+ std::cout << std::endl << "items()" << std::endl;
+ const std::vector<char>& items = q.items();
+ for (std::vector<char>::const_iterator i = items.begin();
+ items.end() != i; ++i) {
+ std::cout << *i << std::endl;
+ }
+
+ std::cout << std::endl << "capacity()" << std::endl;
+ std::cout << q.capacity() << std::endl;
+
+ std::cout << std::endl << "head()" << std::endl;
+ std::cout << q.head() << std::endl;
+
+ std::cout << std::endl << "is_empty()" << std::endl;
+ std::cout << q.is_empty() << std::endl;
+
+ std::cout << std::endl << "is_full()" << std::endl;
+ std::cout << q.is_full() << std::endl;
+
+ std::cout << std::endl << "remove()" << std::endl;
+ q.remove();
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/simple_queue/simple_queue.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,165 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef SIMPLE_QUEUE_HPP_
+#define SIMPLE_QUEUE_HPP_
+
+#include <contract.hpp>
+#include <vector>
+
+/** Simple queue. */
+template<typename T>
+class simple_queue {
+
+ CONTRACT_CLASS( (simple_queue)
+ (invariant) ({
+ CONTRACT_ASSERT( count() >= 0 );
+ }) )
+
+public:
+ // Creation //
+
+ /** Create empty queue. */
+ simple_queue(const int& the_capacity): items_()
+ CONTRACT_CONSTRUCTOR(
+ (public) (simple_queue)( (const int&)(the_capacity) )
+ (precondition) ({
+ CONTRACT_ASSERT( the_capacity >= 1 );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( capacity() == the_capacity );
+ CONTRACT_ASSERT( is_empty() );
+ })
+ (body) ({
+ items_.reserve(the_capacity);
+ }) )
+
+ /** Destroy queue. */
+ virtual ~simple_queue(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (simple_queue)( (void) )
+ (body) ({
+ }) )
+
+ // Basic Queries //
+
+ /** Items in the queue (in their order). */
+ const std::vector<T>& items(void) const
+ CONTRACT_FUNCTION(
+ (public) (const std::vector<T>&) (items)( (void) ) (const)
+ (body) ({
+ return items_;
+ }) )
+
+ /** Maximum number of items queue can hold. */
+ int capacity(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (capacity)( (void) ) (const)
+ (body) ({
+ return items_.capacity();
+ }) )
+
+ // Derived Queries //
+
+ /** Number of items. */
+ int count(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == int(items().size()) );
+ })
+ (body) ({
+ return items_.size();
+ }) )
+
+ /** Item at head. */
+ const T& head(void) const
+ CONTRACT_FUNCTION(
+ (public) (const T&) (head)( (void) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( !is_empty() );
+ })
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == items().at(0) );
+ })
+ (body) ({
+ return items_.at(0);
+ }) )
+
+ /** If queue contains no items. */
+ bool is_empty(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (is_empty)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == (0 == count()) );
+ })
+ (body) ({
+ return 0 == items_.size();
+ }) )
+
+ /** If queue has no room for another item. */
+ bool is_full(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (is_full)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result ==
+ (int(items().size()) == capacity()) );
+ })
+ (body) ({
+ return items_.size() == items_.capacity();
+ }) )
+
+ // Commands //
+
+ /** Remove head item shifting all other items accordingly. */
+ void remove(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (remove)( (void) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( !is_empty() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() - 1) );
+
+ for (size_t i = 1; i < CONTRACT_OLDOF(this)->items().size();
+ ++i)
+ CONTRACT_ASSERT( items().at(i - 1) ==
+ CONTRACT_OLDOF(this)->items().at(i) );
+ })
+ (body) ({
+ items_.erase(items_.begin());
+ }) )
+
+ /** Add item to tail. */
+ void put(const T& item)
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const T&)(item) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( count() < capacity() );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() + 1) );
+ CONTRACT_ASSERT( items().at(count() - 1) == item );
+ if (count() >= 2) {
+ for (int i = 0; i < CONTRACT_OLDOF(this)->count(); ++i) {
+ CONTRACT_ASSERT( items().at(i) ==
+ CONTRACT_OLDOF(this)->items().at(i) );
+ }
+ }
+ })
+ (body) ({
+ items_.push_back(item);
+ }) )
+
+private:
+ std::vector<T> items_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,34 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "stack.hpp"
+#include <string>
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ stack<std::string> s;
+
+ std::cout << std::endl << "count()" << std::endl;
+ std::cout << s.count() << std::endl;
+
+ std::cout << std::endl << "put()" << std::endl;
+ s.put("Galileo");
+
+ std::cout << std::endl << "item_at()" << std::endl;
+ std::cout << s.item_at(1) << std::endl;
+
+ std::cout << std::endl << "remove()" << std::endl;
+ s.remove();
+
+ std::cout << std::endl << "is_empty()" << std::endl;
+ std::cout << s.is_empty() << std::endl;
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Mitchell2002/stack/stack.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,128 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef STACK_HPP_
+#define STACK_HPP_
+
+#include <contract.hpp>
+#include <vector>
+
+/** Simple stack. */
+template<typename T>
+class stack {
+
+ CONTRACT_CLASS( (stack)
+ (invariant) ({
+ CONTRACT_ASSERT( count() >= 0 );
+ }) )
+
+public:
+ // Creation //
+
+ /** Create empty stack. */
+ stack(void): items_()
+ CONTRACT_CONSTRUCTOR(
+ (public) (stack)( (void) )
+ (postcondition) ({
+ CONTRACT_ASSERT( count() == 0 );
+ })
+ (body) ({
+ }) )
+
+ /** Destroy stack. */
+ ~stack(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (stack)( (void) )
+ (body) ({
+ }) )
+
+ // Basic Queries //
+
+ /** Number of items. */
+ int count(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (count)( (void) ) (const)
+ (body) ({
+ return items_.size();
+ }) )
+
+ /** Item at index in [1, count()] (Eiffel index starts at 1). */
+ const T& item_at(const int& index) const
+ CONTRACT_FUNCTION(
+ (public) (const T&) (item_at)( (const int&)(index) )
+ (const)
+ (precondition) ({
+ CONTRACT_ASSERT( index >= 1 );
+ CONTRACT_ASSERT( index <= count() );
+ })
+ (body) ({
+ return items_.at(index - 1);
+ }) )
+
+ // Derived Queries //
+
+ /** If no items. */
+ bool is_empty(void) const
+ CONTRACT_FUNCTION(
+ (public) (bool) (is_empty)( (void) ) (const)
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == (count() == 0) );
+ })
+ (body) ({
+ return items_.size() == 0;
+ }) )
+
+ /** Top item. */
+ const T& item(void) const
+ CONTRACT_FUNCTION(
+ (public) (const T&) (item)( (void) ) (const)
+ (precondition) ({
+ CONTRACT_ASSERT( count() > 0 );
+ })
+ (postcondition) (result) ({
+ CONTRACT_ASSERT( result == item_at(count()) );
+ })
+ (body) ({
+ return items_.at(items_.size() - 1);
+ }) )
+
+ // Commands //
+
+ /** Push new item to the top. */
+ void put(const T& new_item)
+ CONTRACT_FUNCTION(
+ (public) (void) (put)( (const T&)(new_item) ) (copyable)
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() + 1) );
+ CONTRACT_ASSERT( item() == new_item );
+ })
+ (body) ({
+ items_.push_back(new_item);
+ }) )
+
+ /** Pop top item. */
+ void remove(void)
+ CONTRACT_FUNCTION(
+ (public) (void) (remove)( (void) ) (copyable)
+ (precondition) ({
+ CONTRACT_ASSERT( count() > 0 );
+ })
+ (postcondition) ({
+ CONTRACT_ASSERT( count() ==
+ (CONTRACT_OLDOF(this)->count() - 1) );
+ })
+ (body) ({
+ items_.resize(items_.size() - 1);
+ }) )
+
+private:
+ std::vector<T> items_;
+};
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,5 @@
+Examples that illustrate how to use the library to write contracts.
+
+Many of these examples are taken from books, papers, etc.
+The directory names reflect the example sources.
+See the library documentation for a complete reference list.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,2 @@
+Examples of contracts.
+Adapted from book "The C++ Programming Language", 1997.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "string.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ String s("Galileo");
+
+ std::cout << std::endl << "operator[]" << std::endl;
+ std::cout << s[0] << std::endl;
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,36 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "string.hpp"
+
+CONTRACT_CONSTRUCTOR_BODY(String, String)(const char* q) {
+ init(q);
+}
+
+CONTRACT_CONSTRUCTOR_BODY(String, String)(const String& s) {
+ init(s.p);
+}
+
+CONTRACT_DESTRUCTOR_BODY(String, String)(void) {
+ delete[] p;
+}
+
+char& String::CONTRACT_MEMBER_BODY(operator([], at))(int i) {
+ // check invariant and preconditions on entry
+ return p[i]; // do work
+ // check invariant on exit
+}
+
+int String::CONTRACT_MEMBER_BODY(size)(void) { return sz; }
+
+void String::CONTRACT_MEMBER_BODY(init)(const char* q) {
+ sz = strlen(q);
+ p = new char[sz + 1];
+ for (int i = 0; i < sz; ++i) p[i] = q[i];
+ p[sz] = '\0';
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/Stroustrup1997/string/string.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,81 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+
+// Adapted from an example presented in [Stroustrup1997] to illustrate
+// importance of invariants. Simple preconditions were added where it
+// made sense. This should be compiled with postconditions checking
+// turned off because postconditions are deliberately not used.
+// See [Stroustrup1997] for a discussion on the importance of
+// invariants, and on pros and cons of using pre and post conditions.
+class String {
+
+ CONTRACT_CLASS( (String)
+ (invariant) (
+ // It would be better to assert invariants conditions separately
+ // so to generate more informative error in case thay are broken.
+ (p && sz >= 0 && TOO_LARGE >= sz && !p[sz] ? true : throw Invariant())
+ ) )
+
+ int sz;
+ char* p;
+
+public:
+ // Broken contracts throw user defined exceptions.
+ class Range {}; // exception classes
+ class Invariant {};
+ class Null {};
+ class Too_large {};
+
+ enum { TOO_LARGE = 16000 }; // length limit
+
+ CONTRACT_CONSTRUCTOR(
+ (public) (String)( (const char*)(q) )
+ (precondition)(
+ (q ? true : throw Null())
+ (strlen(q) <= TOO_LARGE ? true : throw Too_large())
+ )
+ (
+ ;
+ ) )
+
+ CONTRACT_CONSTRUCTOR(
+ (public) (String)( (const String&)(s) )
+ (
+ ;
+ ) )
+
+ CONTRACT_DESTRUCTOR(
+ (public) (String)( (void) )
+ (
+ ;
+ ) )
+
+ CONTRACT_FUNCTION(
+ (public) (char&) (operator([], at))( (int)(i) )
+ (precondition)(
+ (i >= 0 && sz > i ? true : throw Range())
+ )
+ (
+ ;
+ ) )
+
+ CONTRACT_FUNCTION(
+ (public) (int) (size)( (void) )
+ (
+ ;
+ ) )
+
+private:
+ CONTRACT_FUNCTION( // not public so it does not check invariants
+ (private) (void) (init)( (const char*)(q) )
+ (
+ ;
+ ) )
+};
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/commas/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Show how to pass commas within macro parameters (used by documentation).
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/commas/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,58 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+#include <map>
+
+template<typename K, typename T>
+void print(const K& key, const T& element) {
+ std::cout << key << " -> " << element << std::endl;
+}
+
+//[ commas_cpp
+
+template<typename K, typename T>
+std::map<K, T> fill(const std::map<K, T>& source,
+ const K& key, const T& element)
+CONTRACT_FUNCTION(
+ (template)( (typename)(K) (typename)(T) )
+ // Commas within type expression using the macro.
+ (typename CONTRACT_WRAP_TYPE( (std::map<K, T>) )) (set)(
+ // Or equivalently, not using the macro.
+ (typename contract::wrap<void
+ (const std::map<K, T>&) >::type)(source)
+ (const K&)(key) (const T&)(element) )
+(precondition) ({
+ // Commas within value expressions must be wrapped by `()`.
+ CONTRACT_ASSERT( (std::map<K, T>().empty()) );
+})
+(body) ({
+ // Commas within code blocks use same workarounds as above
+ // wrapping differently commas within type or value expressions.
+ // Or better, separate body definition so it is outside the macro.
+
+ // OK, commas already wrapped by function call `()`.
+ print(key, element);
+
+ // Commas within type expression wrapped using the macro.
+ typename CONTRACT_WRAP_TYPE((std::map<K, T>)) m = source;
+
+ // OK, commas already wrapped by if-statement `()`.
+ if (0 == std::map<K, T>().empty()) m[key] = element;
+
+ return m;
+}) )
+
+//]
+
+int main() {
+ std::map<int, double> m1;
+ std::map<int, double> m2 = set(m1, 1, 2.3);
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/cv/REAME.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Const and volatile qualifier supports as usual.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/cv/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,165 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+// Qualified member access works as usual:
+// 1. Class invariants can access any const and const-volatile member.
+// 2. Pre/postconditions of const members can access any const and
+// const-volatile member.
+// 3. However, pre/postconditions of volatile members can only access
+// const-volatile members.
+
+class b {
+
+ CONTRACT_CLASS( (b) )
+
+public:
+ virtual ~b(void)
+ CONTRACT_DESTRUCTOR(
+ (public) (virtual) (b)( (void) )
+ (body) ({
+ }) )
+
+ virtual int f(void)
+ CONTRACT_FUNCTION(
+ (public) (virtual) (int) (f)( (void) )
+ (body) ({
+ return -1;
+ }) )
+
+ virtual int f(void) const
+ CONTRACT_FUNCTION(
+ (public) (virtual) (int) (f)( (void) ) (const)
+ (body) ({
+ return -2;
+ }) )
+
+ virtual int f(void) volatile
+ CONTRACT_FUNCTION(
+ (public) (virtual) (int) (f)( (void) ) (volatile)
+ (body) ({
+ return -3;
+ }) )
+
+ virtual int f(void) const volatile
+ CONTRACT_FUNCTION(
+ (public) (virtual) (int) (f)( (void) ) (const) (volatile)
+ (body) ({
+ return -4;
+ }) )
+};
+
+//[ cv_cpp
+
+class z: public b { // Some base class b to show subcontracting.
+
+ CONTRACT_CLASS( (z) (b)
+ (invariant) ({ // const
+ CONTRACT_ASSERT( check_c() && check_cv() );
+ }) )
+
+public:
+ z(void) {}
+
+ // For old object, must manually program const-correct copy
+ // constructor for volatile type (instead use `z(constz&)`
+ // automatically synthesized by C++ for non-volatile type).
+ z(const volatile z& source) {}
+
+ int f(void)
+ CONTRACT_FUNCTION(
+ (public) (int) (f)( (void) ) (copyable) // no-cv
+ (precondition) ({ // const
+ CONTRACT_ASSERT( check_c() && check_cv() );
+ })
+ (postcondition) (result) ({ // const
+ CONTRACT_ASSERT( check_c() && check_cv() );
+ CONTRACT_ASSERT( // oldof(this) also const
+ CONTRACT_OLDOF(this)->check_c() &&
+ CONTRACT_OLDOF(this)->check_cv() );
+ })
+ (body) ({ // no-cv
+ check_nocv(); check_c(); check_v(); check_cv();
+ return 1;
+ }) )
+
+ int f(void) const
+ CONTRACT_FUNCTION(
+ (public) (int) (f)( (void) ) (const) (copyable)
+ (precondition) ({ // const
+ CONTRACT_ASSERT( check_c() && check_cv() );
+ })
+ (postcondition) (result) ({ // const
+ CONTRACT_ASSERT( check_c() && check_cv() );
+ CONTRACT_ASSERT( // oldof(this) also const
+ CONTRACT_OLDOF(this)->check_c() &&
+ CONTRACT_OLDOF(this)->check_cv() );
+ })
+ (body) ({ // const
+ check_c(); check_cv();
+ return 2;
+ }) )
+
+ int f(void) volatile
+ CONTRACT_FUNCTION(
+ (public) (int) (f)( (void) ) (volatile) (copyable)
+ (precondition) ({ // const volatile
+ CONTRACT_ASSERT( check_cv() );
+ })
+ (postcondition) (result) ({ // const volatile
+ CONTRACT_ASSERT( check_cv() );
+ CONTRACT_ASSERT( // oldof(this) also const volatile
+ CONTRACT_OLDOF(this)->check_cv() );
+ })
+ (body) ({ // volatile
+ check_v(); check_cv();
+ return 3;
+ }) )
+
+ int f(void) const volatile // const appears before volatile.
+ CONTRACT_FUNCTION(
+ (public) (int) (f)( (void) ) (const) (volatile) (copyable)
+ (precondition) ({ // const volatile
+ CONTRACT_ASSERT( check_cv() );
+ })
+ (postcondition) (result) ({ // const volatile
+ CONTRACT_ASSERT( check_cv() );
+ CONTRACT_ASSERT( // oldof(this) also const volatile
+ CONTRACT_OLDOF(this)->check_cv() );
+ })
+ (body) ({ // const volatile
+ check_cv();
+ return 4;
+ }) )
+
+ // Used to demonstrate qualified member access constraints.
+ bool check_nocv(void) { return true; }
+ bool check_c(void) const { return true; }
+ bool check_v(void) volatile { return true; }
+ bool check_cv(void) const volatile { return true; }
+};
+
+//]
+
+int main() {
+ z nocv_z;
+ std::cout << nocv_z.f() << std::endl;
+
+ const z& c_z = nocv_z;
+ std::cout << c_z.f() << std::endl;
+
+ volatile z& v_z = nocv_z;
+ std::cout << v_z.f() << std::endl;
+
+ const volatile z& cv_z = nocv_z;
+ std::cout << cv_z.f() << std::endl;
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/exspecs/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Exception specifications supported only for member functions.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/exspecs/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,73 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <string>
+
+// NOTE: If contract failure handlers are redefined to throw
+// exceptions, exceptions specifications apply to exceptions thrown
+// by both the body and by the contract failure handlers.
+//
+// LIMITATION: Non-member functions with exception specifications
+// cannot be contracted.
+//
+// void some(const std::string& what) throw(char, int)
+// CONTRACT_FUNCTION( ... ) // Error.
+// void none(const std::string& what) throw()
+// CONTRACT_FUNCTION( ... ) // Error.
+//
+// WORKAROUND: Make these functions static member functions of some
+// artificial class and then contract them.
+
+//[ exspecs_cpp
+
+class c { // Some artificially introduced class.
+
+ CONTRACT_CLASS( (c) )
+
+public:
+ static void some(const std::string& what) throw(char, int)
+ CONTRACT_FUNCTION( // Ex. specs not repeated in signature.
+ (public) (static) (void) (some)( (const std::string&)(what) )
+ (body) ({
+ if (what == "none") return; // OK.
+ if (what == "char") throw char('a'); // OK.
+ if (what == "int") throw int(-1); // OK.
+ throw what; // Not in specs so terminate() is called.
+ }) )
+
+ static void none(const std::string& what) throw()
+ CONTRACT_FUNCTION( // Ex. specs not repeated in signature.
+ (public) (static) (void) (none)( (const std::string&)(what) )
+ (body) ({
+ if (what == "none") return; // OK.
+ throw what; // Not in specs so terminate() is called.
+ }) )
+};
+
+//]
+
+int main() {
+ std::cout << "some:" << std::endl;
+ c::some("none");
+ try { c::some("char"); }
+ catch (char& ex) { std::cerr << ex << std::endl; }
+ try { c::some("int"); }
+ catch (int& ex) { std::cerr << ex << std::endl; }
+ // Exceptions specs correctly call terminate() for the following.
+ // try { c::some("string"); }
+ // catch (std::string& ex) { std::cerr << ex << std::endl; }
+
+ std::cout << "none:" << std::endl;
+ c::none("none");
+ // Exceptions specs correctly call terminate for the following.
+ // try { c::none("string"); }
+ // catch (std::string& ex) { std::cerr << ex << std::endl; }
+
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/extern/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Extern (non-member) functions supported as usual.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/extern/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,32 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+//[ extern_cpp
+
+extern void ext(int x) // Some external linkage.
+CONTRACT_FUNCTION( (extern) (void) (ext)( (int)(x) )
+(body) ({
+ std::cout << x << std::endl;
+}) )
+
+extern "C" void ext_c(int x) // External linkage callable from C.
+CONTRACT_FUNCTION( (extern "C") (void) (ext_c)( (int)(x) )
+(body) ({
+ std::cout << x << std::endl;
+}) )
+
+//]
+
+int main() {
+ ext(1);
+ ext_c(2);
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/friend/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Show how to handle friend non-member functions.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/friend/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,40 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+//[ friend_cpp
+
+class point {
+public:
+ point(const double& x, const double& y): x_(x), y_(y) {}
+
+ // Declare friend the body and separate the definition.
+ friend std::ostream& CONTRACT_BODY(operator(<<, out))(
+ std::ostream& s, const point& o);
+
+private:
+ double x_;
+ double y_;
+};
+
+std::ostream& operator<<(std::ostream& s, const point& o)
+CONTRACT_FUNCTION( (std::ostream&) (operator(<<, out))(
+ (std::ostream&)(s) (const point&)(o) )
+(body) ({
+ return s << "(" << o.x_ << ", " << o.y_ << ")";
+}) )
+
+//]
+
+int main() {
+ point pt(1.2, 3.4);
+ std::cout << pt << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/inline/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Inline member and non-member functions supported as usual.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/inline/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,41 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+//[ inline_cpp
+
+class z {
+
+ CONTRACT_CLASS( (z) )
+
+public:
+ inline void inl(int x)
+ CONTRACT_FUNCTION(
+ (public) (inline) (void) (inl)( (int)(x) )
+ (body) ({
+ std::cout << x << std::endl;
+ }) )
+};
+
+inline void inl(int x)
+CONTRACT_FUNCTION(
+ (inline) (void) (inl)( (int)(x) )
+(body) ({
+ std::cout << x << std::endl;
+}) )
+
+//]
+
+int main() {
+ z zz;
+ zz.inl(1);
+ inl(2);
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+This is the main example used in the library documentation.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/basic_begin.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,33 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef BASIC_BEGIN_HPP_
+#define BASIC_BEGIN_HPP_
+
+//[ basic_begin_cpp
+
+#include <contract.hpp>
+
+template<class ConstIter>
+class basic_begin {
+
+ CONTRACT_CLASS( (basic_begin) )
+
+public:
+ virtual ~basic_begin(void) {}
+
+ CONTRACT_FUNCTION(
+ (public) (virtual) (ConstIter) (begin)( (void) ) (const)
+ ({
+ return ConstIter(); // Dummy implementation (for example only).
+ }) )
+};
+
+//]
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/boundable.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,38 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef BOUNDABLE_HPP_
+#define BOUNDABLE_HPP_
+
+//[ boundable_cpp
+
+#include <contract.hpp>
+
+template<class ConstIter>
+class boundable {
+
+ CONTRACT_CLASS( (boundable)
+ (invariant)(
+ (begin() <= end())
+ ) )
+
+public:
+ virtual ~boundable(void) {}
+
+ CONTRACT_FUNCTION(
+ (public) (virtual) (ConstIter) (begin)( (void) ) (const)
+ (
+ = 0;
+ ) )
+
+ virtual ConstIter end(void) const = 0;
+};
+
+//]
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,48 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "myvector.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ myvector<double> v(3);
+ const myvector<double>& cv = v; // A reference, no copy.
+
+ std::cout << std::endl << "copy constructor()" << std::endl;
+ myvector<double> w(v);
+
+ std::cout << std::endl << "begin()" << std::endl;
+ myvector<double>::iterator b = v.begin();
+ std::cout << *b << std::endl;
+
+ std::cout << std::endl << "begin() const" << std::endl;
+ myvector<double>::const_iterator cb = cv.begin();
+ std::cout << *cb << std::endl;
+
+ std::cout << std::endl << "insert()" << std::endl;
+ v.insert(b, 2, -3.21);
+
+ std::cout << std::endl << "operator[]" << std::endl;
+ double v0 = v[0];
+ std::cout << v0 << std::endl;
+
+ std::cout << std::endl << "push_back()" << std::endl;
+ v.push_back(1.23);
+
+ std::cout << std::endl << "all_equals()" << std::endl;
+ bool eq = myvector<double>::all_equals(v.begin(), v.end(), 1.23);
+ std::cout << eq << std::endl; // It will be false.
+
+ std::cout << std::endl << "abs_total()" << std::endl;
+ double tot = abs_total(v);
+ std::cout << tot << std::endl;
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/main_nomacros.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,29 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include "myvector_nomacros.hpp"
+#include <iostream>
+
+int main() {
+ std::cout << std::endl << "constructor()" << std::endl;
+ myvector<double> v(3);
+
+ std::cout << std::endl << "push_back()" << std::endl;
+ v.push_back(1.23);
+
+ std::cout << std::endl << "all_equals()" << std::endl;
+ bool eq = myvector<double>::all_equals(v.begin(), v.end(), 1.23);
+ std::cout << eq << std::endl; // It will be false.
+
+ std::cout << std::endl << "abs_total()" << std::endl;
+ double tot = abs_total(v);
+ std::cout << tot << std::endl;
+
+ std::cout << std::endl << "destructor()" << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/myvector.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,247 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef MYVECTOR_HPP_
+#define MYVECTOR_HPP_
+
+//[ myvector_cpp
+
+#include "pushable.hpp" // Base classes for subcontracting.
+#include "boundable.hpp"
+#include "basic_begin.hpp"
+#include <contract.hpp> // This library.
+#include <boost/utility.hpp> // For `boost::prior()`.
+#include <vector> // STL vector.
+
+// Wrapper that adds simple (not complete) contracts to C++ STL illustrating
+// most library usages. For simplicity, assume T is comparable and copyable.
+template<typename T>
+class myvector: public pushable<T>,
+ public boundable<typename std::vector<T>::const_iterator>,
+ private basic_begin<typename std::vector<T>::const_iterator> {
+public:
+ typedef typename std::vector<T>::size_type size_type;
+ typedef typename std::vector<T>::iterator iterator;
+ typedef typename std::vector<T>::const_iterator const_iterator;
+ typedef typename std::vector<T>::const_reference const_reference;
+
+private:
+ // Class invariants (checked by any function with a contract).
+ CONTRACT_CLASS( (myvector) // This class.
+ // Subcontract from base classes (support for multiple inheritance).
+ (pushable<T>) (boundable<const_iterator>) (basic_begin<const_iterator>)
+ (static) (invariant)( // Static invariants cannot access object (optional).
+ (true) // Dummy assertion in this example.
+ )
+ (invariant)( // Non-static invariants can access object (optional).
+ (empty() == (size() == 0))
+ // More invariants here...
+ ) )
+
+public:
+ // Contract for constructor.
+ CONTRACT_CONSTRUCTOR(
+ (public) (explicit) (myvector)( (size_type)(count) )
+ (vector_(count)) // Member initializers.
+ // Never object `this` in constructor preconditions.
+ (postcondition)(
+ // Never `CONTRACT_OLDOF(this)` in constructor postconditions.
+ (size() == count)
+ )
+ ({
+ // Do nothing in this example.
+ }) )
+
+ // Contractor for overloaded member (resolved by argumnet name).
+ CONTRACT_CONSTRUCTOR(
+ (public) (myvector)( (const myvector&)(right) )
+ (postcondition)(
+ (vector_ == right.vector_)
+ )
+ (
+ ; // Deferres body definition.
+ // Deferred body definitions show useful compiler-error line numbers.
+ ) )
+
+ // Contract for destructor.
+ CONTRACT_DESTRUCTOR(
+ // No `~` in destructor name.
+ // Use `(void)` for empty function paramters.
+ (public) (virtual) (myvector)( (void) )
+ // No preconditions allowed (no arguments).
+ // No postconditions allowed (no object after destructor).
+ (
+ ;
+ ) )
+
+ // Contract for member function.
+ // Copy old values for object `this` and argument `where`.
+ CONTRACT_FUNCTION(
+ (public) (void) (insert)(
+ // Multiple function parameters.
+ (copyable)(iterator)(where)
+ (size_type)(count)
+ (const T&)(element)
+ ) (copyable)
+ (precondition)( // Function preconditions (optional).
+ (max_size() >= (size() + count))
+ // More preconditions here...
+ )
+ (postcondition)( // Function postconditions (optional).
+ // Old values via `CONTRACT_OLDOF()` for types qualified copyable.
+ // Assertion with if-guard (i.e., "select-assertion").
+ (if (capacity() == CONTRACT_OLDOF(this)->capacity()) (
+ (all_equals(
+ boost::prior(CONTRACT_OLDOF(where)),
+ boost::prior(CONTRACT_OLDOF(where)) + count,
+ element))
+ ) ) // Optional `(else ...)` allowed here.
+ // More postconditions here...
+ )
+ ({ // Original function implementation.
+ vector_.insert(where, count, element);
+ }) )
+
+ // Contract for constant member.
+ // Non-void result type.
+ CONTRACT_FUNCTION(
+ (public) (const_iterator) (begin)( (void) ) (const) // Constant.
+ (postcondition)(result)( // Return value named `result`.
+ (if (empty()) (
+ (result == end())
+ ) )
+ )
+ ({
+ return vector_.begin();
+ }) )
+
+ // Contract for overloaded member (resolved because not const).
+ CONTRACT_FUNCTION(
+ (public) (iterator) (begin)( (void) )
+ (postcondition)(result)(
+ (if (empty()) (
+ (result == end())
+ ) )
+ )
+ (
+ ;
+ ) )
+
+ // Contract for operator.
+ CONTRACT_FUNCTION(
+ // Must spell operator name also in words (e.g., `at`).
+ (public) (const_reference) (operator([], at))( (size_type)(index) ) (const)
+ (precondition)(
+ (index < size())
+ )
+ (
+ ;
+ ) )
+
+ // Main function example used in documentation.
+ CONTRACT_FUNCTION(
+ (public) (void) (push_back)( (const T&)(element) ) (copyable)
+ (precondition)(
+ (size() < max_size())
+ )
+ (postcondition)(
+ (size() == (CONTRACT_OLDOF(this)->size() + 1))
+ )
+ ({
+ vector_.push_back(element);
+ }) )
+
+ // Contract for template plus static member function.
+ CONTRACT_FUNCTION(
+ (public) (template)( (class)(Iter) ) // Function template.
+ (requires)( // Concepts.
+ (boost::InputIterator<Iter>)
+ (boost::Comparable<T>) // For simplicity, assume T can be compared.
+ )
+ (static) (bool) (all_equals)( // Static member.
+ (Iter)(first)
+ (Iter)(last)
+ (const T&)(element)
+ )
+ (precondition)(
+ (first < last)
+ )
+ ({
+ for (Iter i = first; i < last; ++i) {
+ if (*i != element) return false;
+ }
+ return true;
+ }) )
+
+ // Similarly, complete contracts sketched here and add contracts
+ // for all other functions (see [Crowl2006] vector example).
+ bool empty(void) const { return vector_.empty(); }
+ size_type size(void) const { return vector_.size(); }
+ size_type max_size(void) const { return vector_.max_size(); }
+ size_type capacity(void) const { return vector_.capacity(); }
+ iterator end(void) { return vector_.end(); }
+ const_iterator end(void) const { return vector_.end(); }
+ const_reference back(void) const { return vector_.back(); }
+
+private:
+ std::vector<T> vector_;
+};
+
+// Deferred constructor body definition.
+template<typename T>
+CONTRACT_CONSTRUCTOR_BODY(myvector<T>, myvector)(const myvector& right) {
+ vector_ = right.vector_;
+}
+
+// Deferred destructor body definition.
+template<typename T>
+CONTRACT_DESTRUCTOR_BODY(myvector<T>, myvector)(void) {
+ // Do nothing in this case.
+}
+
+// Deferred member function definition.
+template<typename T>
+typename myvector<T>::iterator myvector<T>::CONTRACT_BODY(begin)(void) {
+ return vector_.begin();
+}
+
+// Deferred member operator definition.
+template<typename T>
+typename myvector<T>::const_reference myvector<T>::CONTRACT_BODY(operator([], at))(
+ size_type index) const {
+ return vector_[index];
+}
+
+// Contract for non-member function.
+CONTRACT_FUNCTION(
+(double) (abs_total)( (const myvector<double>&)(vector) )
+ (postcondition)(total)( // Return value named `total` (instead of `result`).
+ (total >= 0.0)
+ )
+({
+ double total = 0.0;
+ // Block invariants can appear anywhere in code block.
+ CONTRACT_ASSERT_BLOCK_INVARIANT( total == 0.0 );
+
+ { // Variant initialized locally to its loop.
+ CONTRACT_INIT_LOOP_VARIANT;
+ for (size_t i = 0; i < vector.size(); ++i) {
+ // Block invariants used to assert loop invariants.
+ CONTRACT_ASSERT_BLOCK_INVARIANT( i < vector.size() );
+ // Loop variant (can only appear in loops).
+ CONTRACT_ASSERT_LOOP_VARIANT( vector.size() - i );
+
+ total += vector[i];
+ }
+ }
+ return total < 0.0 ? -total : total;
+}) )
+
+//]
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/myvector_nomacros.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,330 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef MYVECTOR_NOMACROS_HPP_
+#define MYVECTOR_NOMACROS_HPP_
+
+//[ myvector_nomacros_cpp
+
+#include "pushable.hpp" // Base class for subcontracting.
+#include <contract.hpp> // This library.
+#include <vector> // STL vector.
+
+// Wrapper that adds simple (not complete) contracts to C++ STL
+// without using the library contract macros.
+template<typename T>
+class myvector: public pushable<T> {
+
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || /* Allow for */ \
+ defined CONTRACT_CHECK_PRECONDITION || /* optional contract */ \
+ defined CONTRACT_CHECK_POSTCONDITION /* compilation. */
+ // Augmented state.
+ friend class contract::state;
+ mutable contract::state contract_state_;
+#endif // contracts
+
+#if defined CONTRACT_CHECK_CLASS_INVARIANT
+ // Static class invariants
+ static void contract_static_invariant_(void) {
+ // Assert nothing in this case.
+ }
+ // Class invariants.
+ void contract_invariant_(void) const {
+ if (!((size() == 0) == empty()))
+ throw contract::failure(__FILE__, __LINE__);
+ // More invariants here...
+ }
+#endif // invariants
+
+public:
+ typedef typename std::vector<T>::size_type size_type;
+ typedef typename std::vector<T>::const_reference const_reference;
+ typedef typename std::vector<T>::const_iterator const_iterator;
+
+ // Contract for constructor.
+ explicit myvector(size_type count): vector_(count)
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ {
+ contract_contract_constructor_count_<0>().call(this, count);
+ }
+private:
+#if defined CONTRACT_CHECK_PRECONDITION
+ // Static preconditions (i.e., no object).
+ static void contract_precondition_contract_constructor_count_(
+ const size_type& count) /* no `const` (it is `static`) */ {
+ }
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ void contract_postcondition_contract_constructor_count_(
+ contract::noold, // Always `noold` for old object.
+ const size_type& count, contract::noold) const {
+ if (!(size() == count))
+ throw contract::failure(__FILE__, __LINE__);
+ }
+#endif // postconditions
+protected:
+ void contract_body_contract_constructor_(size_type count)
+#endif // contracts
+ {
+ // Do nothing in this case
+ }
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ template<int ZERO>
+ struct contract_contract_constructor_count_:
+ contract::constructor< // Use `constructor` (not `function`).
+ // Class type can never be tagged `copyable`.
+ void (myvector*, size_type)> {
+ contract_contract_constructor_count_(): contract::constructor <
+ void (myvector*, size_type)
+ >( &myvector::contract_body_contract_constructor_
+#if defined CONTRACT_CHECK_PRECONDITION
+ , &myvector::contract_precondition_contract_constructor_count_
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ , &myvector::contract_postcondition_contract_constructor_count_
+#endif // postconditions
+ ) {}
+ };
+public:
+#endif // contracts
+
+ // Contract for destructor.
+ virtual ~myvector(void)
+ // Destructors only check invariants.
+#if defined CONTRACT_CHECK_CLASS_INVARIANT
+ {
+ contract_contract_destructor_<0>().call(this);
+ }
+protected:
+ // No precondition and no postcondition functions.
+ virtual void contract_body_contract_destructor_(void)
+#endif // invariant
+ {
+ // Do nothing in this case.
+ }
+#if defined CONTRACT_CHECK_CLASS_INVARIANT
+ template<int ZERO>
+ struct contract_contract_destructor_:
+ contract::destructor< // Use `destructor` (not `function`).
+ // Class type can never be tagged `copyable`.
+ void (myvector*)> {
+ contract_contract_destructor_(): contract::destructor<
+ void (myvector*)
+ >(&myvector::contract_body_contract_destructor_ ) {}
+ };
+public:
+#endif // invariant
+
+ // Contract for non-static member functions.
+ void push_back(const T& element)
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ // Contracted function.
+ {
+ contract_push_back_element_<0>().call(this , element);
+ }
+private: // Private so not to alter user call public API.
+#if defined CONTRACT_CHECK_PRECONDITION
+ void contract_precondition_push_back_element_(const T& element) const {
+ if (!(size() < max_size()))
+ throw contract::failure(__FILE__, __LINE__);
+ // More preconditions here...
+ }
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ void contract_postcondition_push_back_element_(
+ const myvector* contract_old_this_, // Old value for object.
+ const T& element, contract::noold // No old for element argument.
+ ) const {
+ if (!(size() == (contract_old_this_->size() + 1)))
+ throw contract::failure(__FILE__, __LINE__);
+ // More postconditions here...
+ }
+#endif // postconditions
+protected: // Must be protected (not private) to allow subcontracting.
+ void contract_body_push_back_(const T& element)
+#endif // contracts
+ // Original function definition (the body).
+ {
+ vector_.push_back(element);
+ }
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ // Contract class.
+ template<int ZERO>
+ struct contract_push_back_element_: contract::nonstatic_member_function<
+ // Function type with class type pointer as 1st argument.
+ // Copyable class type for old object value in postconditions.
+ // For constant members, change `myvector` to `myvector const`.
+ void (contract::copyable<myvector>*, const T&),
+ // Base contract class for subcontracting.
+ typename pushable<T>::template
+ contract_virtual_push_back_element_<0>
+ > {
+ // Constructor specifies body, preconditions, and postconditions.
+ contract_push_back_element_(): contract::nonstatic_member_function<
+ void (contract::copyable<myvector>*, const T&),
+ typename pushable<T>::template
+ contract_virtual_push_back_element_<0>
+ >( &myvector::contract_body_push_back_
+#if defined CONTRACT_CHECK_PRECONDITION
+ , &myvector::contract_precondition_push_back_element_
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ , &myvector::contract_postcondition_push_back_element_
+#endif // postconditions
+ ) {}
+ };
+public: // Restore original access level.
+#endif // contracts
+
+ // Contract for template plus static member function.
+ template<class Iter>
+ static bool all_equals(Iter first, Iter last, const T& element)
+ // Static members also check (static) class invariants.
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ {
+ return contract_all_equals_first_last_element_<Iter>().call(
+ first, last, element);
+ }
+private:
+ // Static template precondition and postcondition functions.
+#if defined CONTRACT_CHECK_PRECONDITION
+ template<class Iter>
+ static void contract_precondition_all_equals_first_last_element_(
+ const Iter& first, const Iter& last, const T& element)
+ /* no `const` */ {
+ if (!(first < last))
+ throw contract::failure(__FILE__, __LINE__);
+ }
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ template<class Iter>
+ static void contract_postcondition_all_equals_first_last_element_(
+ const Iter& first, contract::noold,
+ const Iter& last, contract::noold,
+ const T& element, contract::noold,
+ const bool& result ) // Result value.
+ /* no `const` */ {
+ }
+#endif // postconditions
+protected:
+ template<class Iter>
+ static bool contract_body_all_equals_(
+ Iter first, Iter last, const T& element)
+#endif // contracts
+ {
+ for (Iter i = first; i < last; ++i) {
+ if (*i != element) return false;
+ }
+ return true;
+ }
+#if defined CONTRACT_CHECK_CLASS_INVARIANT || \
+ defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+ // Function template parameter `class Iter` already present so
+ // no artificial `int ZERO` parameter.
+ template<class Iter>
+ struct contract_all_equals_first_last_element_: contract::static_member_function<
+ bool (myvector*, Iter, Iter, const T&)
+ > {
+ contract_all_equals_first_last_element_(): contract:: static_member_function<
+ bool (myvector*, Iter, Iter, const T&)
+ >( &myvector::template contract_body_all_equals_<Iter>
+#if defined CONTRACT_CHECK_PRECONDITION
+ , &myvector::template contract_precondition_all_equals_first_last_element_<Iter>
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ , &myvector::template contract_postcondition_all_equals_first_last_element_<Iter>
+#endif // postconditions
+ ) {}
+ };
+public:
+#endif // contracts
+
+ // Similarly, complete contracts sketched here and add contracts
+ // for all other functions (see [Crowl2006] vector example).
+ size_type size(void) const { return vector_.size(); }
+ size_type max_size(void) const { return vector_.max_size(); }
+ bool empty(void) const { return vector_.empty(); }
+ const_reference back(void) const { return vector_.back(); }
+ const_iterator begin(void) const { return vector_.begin(); }
+ const_iterator end(void) const { return vector_.end(); }
+ const_reference operator[](size_type index) const
+ { return vector_[index]; }
+
+private:
+ std::vector<T> vector_;
+};
+
+// Contract for non-member function.
+double abs_total(const myvector<double>& vector)
+// Non-member members do not check invariants.
+#if defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+;
+void contract_precondition_abs_total_vector_(
+ const myvector<double>& vector ) {
+}
+void contract_postcondition_abs_total_vector_(
+ const myvector<double>& vector, contract::noold,
+ const double& total) {
+ if (!(total >= 0.0))
+ throw contract::failure(__FILE__, __LINE__);
+}
+double contract_body_abs_total_(const myvector<double>& vector)
+#endif // preconditions or postconditions
+{
+ double total = 0.0;
+ CONTRACT_ASSERT_BLOCK_INVARIANT( total == 0.0 );
+ {
+ CONTRACT_INIT_LOOP_VARIANT;
+ for (size_t i = 0; i < vector.size(); ++i) {
+ CONTRACT_ASSERT_BLOCK_INVARIANT( i < vector.size() );
+ CONTRACT_ASSERT_LOOP_VARIANT( vector.size() - i );
+
+ total += vector[i];
+ }
+ }
+ return total < 0.0 ? -total : total;
+}
+#if defined CONTRACT_CHECK_PRECONDITION || \
+ defined CONTRACT_CHECK_POSTCONDITION
+template<int ZERO>
+struct contract_abs_total_vector_: contract::nonmember_function<
+ // Still use `function` but no class type pointer as 1st argument.
+ double (const myvector<double>&)
+ > {
+ contract_abs_total_vector_(): contract::nonmember_function<
+ double (const myvector<double>&)>
+ ( &contract_body_abs_total_
+#if defined CONTRACT_CHECK_PRECONDITION
+ , &contract_precondition_abs_total_vector_
+#endif // preconditions
+#if defined CONTRACT_CHECK_POSTCONDITION
+ , &contract_postcondition_abs_total_vector_
+#endif // postconditions
+ ) {}
+};
+// Contracted function defined last and always `inline`.
+inline double abs_total(const myvector<double>& vector) {
+ return contract_abs_total_vector_<0>().call(vector);
+}
+#endif // preconditions or postconditions
+
+//]
+
+#endif // #include guard
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/push_back.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,56 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+//[ push_back_cpp
+
+#include "pushable.hpp" // Some base class (for subcontracting).
+#include <contract.hpp> // This library.
+#include <vector> // C++ STL vector.
+
+// Wrapper class that adds contracts to std::vector.
+template<typename T>
+class myvector: public pushable<T> {
+
+ CONTRACT_CLASS( /*< The class signature tokens are passed to the `__CONTRACT_CLASS__()` macro in the exact same order as they appear in the class declaration. The parenthesis `()` around the tokens are mandatory (the create a __Boost_Preprocessor__ /sequence/. >*/ (myvector) (pushable<T>) /*< Subcontract from base contracts in `pushable<T>` (for `push_back()` in this example). Multiple bases classes can be specified to support subcontracting for multiple-inheritance. >*/
+ (invariant)( /*< Static class invariants are also supported. >*/
+ (empty() == (size() == 0)) /*< By default, a contract assertion failure terminates the program. However, programmers can customize the action to take on contract assertion failure to throw exceptions, exit the program, etc. >*/
+ // More invariants here...
+ ) ) /*< No need for "`;`" after the macro closing parenthesis "`)`". >*/
+
+public:
+ CONTRACT_FUNCTION( /*< The function signature tokens are passed to the `__CONTRACT_FUNCTION__()` macro in the exact same order as they appear in the function declaration. The parenthesis `()` around the tokens are mandatory (they create a __Boost_Preprocessor__ sequence). >*/
+ (public) (void) (push_back)( (const T&)(element) ) (copyable) /*< The object is qualified copyable within this function so postconditions can use `CONTRACT_OLDOF(this)` to access a copy of the object before the body is executed. Similarly, the function arguments can also be qualified copyable: For example, if `(copyable)(const T&)(element)` is specified in the function signature then postconditions can use `CONTRACT_OLDOF(element)` to access a copy of the `element` argument before the body execution. >*/
+ (precondition)( /*< The precondition section `(precondition) ({...})` and the postcondition section `(postcondition) ({...})` can both be omitted, the body section `(body) ({...})` is mandatory instead. >*/
+ (size() < max_size())
+ // More preconditions here...
+ )
+ (postcondition)(
+ (size() == (CONTRACT_OLDOF(this)->size() + 1))
+ // More postconditions here...
+ )
+ ({ /*< The body specifies the original function definition. Instead of `{ vector_.push_back(element); }`, `";"` can be used to separate the function definition from its declaration, or `" = 0;"` can be used to write contracts for pure virtual functions. >*/
+ vector_.push_back(element); // Original implementation.
+ }) ) /*< Again, no need for "`;`" after macro closing parenthesis "`)`". >*/
+
+ // Rest of the class here (with more contracts if needed)...
+ typedef typename std::vector<T>::size_type size_type;
+ size_type size(void) const { return vector_.size(); }
+ size_type max_size(void) const { return vector_.max_size(); }
+ bool empty(void) const { return vector_.empty(); }
+ const T& back(void) const { return vector_.back(); }
+private:
+ std::vector<T> vector_;
+};
+
+//]
+
+int main() { // Simple test program.
+ myvector<int> v;
+ v.push_back(123);
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/myvector/pushable.hpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,38 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#ifndef PUSHABLE_HPP_
+#define PUSHABLE_HPP_
+
+//[ pushable_cpp
+
+#include <contract.hpp>
+
+template<typename T>
+class pushable {
+
+ CONTRACT_CLASS( (pushable) )
+
+public:
+ virtual ~pushable(void) {}
+
+ // Contract for pure virtual function.
+ CONTRACT_FUNCTION(
+ (public) (virtual) (void) (push_back)( (const T&)(element) )
+ (postcondition)( (back() == element) )
+ (
+ = 0; // Pure virtual body.
+ ) )
+
+ virtual const T& back(void) const = 0;
+};
+
+//]
+
+#endif // #include guard
+
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/storage/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Show how to handle `auto` and `register` storage specifiers.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/storage/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,44 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+//[ storage_cpp
+
+// `auto` is not repeated in signature sequence.
+double square(auto double d)
+CONTRACT_FUNCTION(
+ (double) (square)( (double)(d) )
+(postcondition) (result) ({
+ CONTRACT_ASSERT( result == (d * d) );
+})
+(body) ({
+ auto double y = d * d;
+ return y;
+}) )
+
+// `register` is not repeated in signature sequence.
+int square(register int i)
+CONTRACT_FUNCTION(
+ (int) (square)( (int)(i) )
+(postcondition) (result) ({
+ CONTRACT_ASSERT( result == (i * i) );
+})
+(body) ({
+ register int y = i * i;
+ return y;
+}) )
+
+//]
+
+int main() {
+ std::cout << square(2.5) << std::endl;
+ std::cout << square(2) << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/struct/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1 @@
+Struct handled exactly same as class.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/struct/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,41 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+#include <contract.hpp>
+#include <iostream>
+
+//[ struct_cpp
+
+struct positive {
+ const double& number;
+
+private: // Alway contract class in a private section at top.
+ CONTRACT_CLASS( (positive)
+ (invariant) ({
+ CONTRACT_ASSERT( number > 0.0 );
+ }) )
+
+public:
+ // Remember to always specify the access level (public, etc).
+ positive(const double& n): number(n)
+ CONTRACT_CONSTRUCTOR(
+ (public) (positive)( (const double&)(n) )
+ (precondition) ({
+ CONTRACT_ASSERT( n > 0.0 );
+ })
+ (body) ({
+ }) )
+};
+
+//]
+
+int main() {
+ positive p(1.23);
+ std::cout << p.number << std::endl;
+ return 0;
+}
+
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/throw/README.txt 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,2 @@
+Show how to configure the library to throw on contract failure
+instead of terminating (used by documentation).
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/example/throw/main.cpp 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,76 @@
+
+// Copyright (C) 2009-2011 Lorenzo Caminiti
+// Use, modification, and distribution is subject to 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).
+
+//[ throw_on_failure_cpp
+
+#include <contract.hpp>
+#include <iostream>
+
+// User defined exception (not even derived from `std::exception`).
+class not_a_number {};
+
+double sqrt(double x)
+CONTRACT_FUNCTION(
+ (double) (sqrt)( (double)(x) )
+(precondition) ({
+ // Eventually throws user-defined exception.
+ if (!( x >= 0.0 )) throw not_a_number();
+})
+(postcondition) (root) ({
+ // Eventually throw library defined exception `contract::failure`.
+ CONTRACT_ASSERT( (root * root) == x );
+})
+(body) ({
+ return 0.0; // Intentionally incorrect to fail postcondition.
+}) )
+
+void throwing_handler(const contract::from& where) {
+ if (where == contract::FROM_DESTRUCTOR) {
+ // Cannot throw from within destructor for STL exception safety.
+ std::clog << "Ignored destructor contract failure" << std::endl;
+ } else {
+ // Failure handlers always called with active an exception.
+ throw; // Re-throw active exception thrown by precondition.
+ }
+}
+
+void postcondition_throwing_handler(const contract::from& where) {
+ // try/catch/re-throw to get active exception (for logging, etc.).
+ try {
+ throw; // Re-throw active exception thrown by precondition.
+ } catch (std::exception& error) { // Get exception object.
+ std::clog << "Throwing '" << error.what() << "'" << std::endl;
+
+ throw; // Re-throw.
+ } // Non standard exception also thrown.
+}
+
+int main() {
+ // Setup contract failure handlers that throw (instead of terminate).
+ contract::set_precondition_failed(&throwing_handler);
+ contract::set_postcondition_failed(&postcondition_throwing_handler);
+ // Invariants not used by this examples but set anyway...
+ contract::set_class_invariant_failed(&throwing_handler);
+ contract::set_block_invariant_failed(&throwing_handler);
+
+ try {
+ std::cout << sqrt(-1.0) << std::endl;
+ } catch (not_a_number&) {
+ std::clog << "Ignored not a number exception" << std::endl;
+ }
+
+ try {
+ std::cout << sqrt(4.0) << std::endl;
+ } catch (...) {
+ std::clog << "Unable to calculate square root" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
Binary file. No diff available.
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/index.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,491 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Contract++ 0.3.490</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="next" href="contract__/getting_started.html" title="Getting Started">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="contract__/getting_started.html"><img src="images/next.png" alt="Next"></a></div>
+<div class="preface">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="contractpp"></a>Contract++ 0.3.490</h2></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright © 2009, 2010 Lorenzo Caminiti</p></div>
+<div><div class="legalnotice">
+<a name="id863692"></a><p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Introduction</span></dt>
+<dt><span class="section">Getting Started</span></dt>
+<dt><span class="section">Tutorial</span></dt>
+<dt><span class="section">Without the Macros</span></dt>
+<dt><span class="section">Examples</span></dt>
+<dt><span class="section">Annex: Throw on Failure</span></dt>
+<dt><span class="section">Annex: Contract Programming</span></dt>
+<dt><span class="section">Appendix: Grammar</span></dt>
+<dt><span class="section">Reference</span></dt>
+<dt><span class="section">Annex: Rationale</span></dt>
+<dt><span class="section">Bibliography</span></dt>
+<dt><span class="section">License</span></dt>
+<dt><span class="section">Release History</span></dt>
+</dl>
+</div>
+<p>
+ The Contract++ library implements Contract Programming for the C++ programming
+ language.
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ What
+ </p>
+ </th>
+<th>
+ <p>
+ Where
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ Download
+ </p>
+ </td>
+<td>
+ <p>
+ http://sourceforge.net/projects/dbcpp/
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Help
+ </p>
+ </td>
+<td>
+ <p>
+ http://sourceforge.net/projects/dbcpp/forums/forum/920163
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Comments
+ </p>
+ </td>
+<td>
+ <p>
+ http://sourceforge.net/projects/dbcpp/forums/forum/920162
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ TO-DO
+ </p>
+ </td>
+<td>
+ <p>
+ http://sourceforge.net/tracker/?group_id=253844&atid=1330818
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Contact the author
+ </p>
+ </td>
+<td>
+ <p>
+ Email <a href="mailto:lorcaminiti_at_[hidden]" target="_top">lorcaminiti_at_[hidden]</a>
+ (with [contract] in the subject)
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="contract__.introduction"></a><a class="link" href="index.html#contract__.introduction" title="Introduction">Introduction</a>
+</h2></div></div></div>
+<p>
+ Contract Programming (CP) is also known as <a href="http://en.wikipedia.org/wiki/Design_by_contract" target="_top">Design
+ by Contract</a> <sup>[<a name="id808260" href="#ftn.id808260" class="footnote">1</a>]</sup> (DbC) and it was first introduced by the Eiffel programming language
+ (see <a class="link" href="contract__/bibliography.html" title="Bibliography">[Meyer1997]</a>). All Contract
+ Programming features of the Eiffel programming language are supported by this
+ library, among others (see <a class="link" href="contract__/contract_programming.html#contract__.contract_programming.features" title="Features">Features</a>):
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Optional compilation and checking of invariants, preconditions, and postconditions.
+ </li>
+<li class="listitem">
+ Customizable actions on contract failure (terminate by default but it can
+ throw, exit, etc).
+ </li>
+<li class="listitem">
+ Subcontracting for derived classes (with support for pure virtual functions
+ and multiple inheritance).
+ </li>
+<li class="listitem">
+ Access to "old" variable values (before body execution) and return
+ value "result" in postconditions.
+ </li>
+<li class="listitem">
+ Support block invariants and loop variants.
+ </li>
+</ul></div>
+<p>
+ In brief, Contract Programming allows to specify invariants, preconditions,
+ and postconditions that are automatically checked when functions are called
+ at run-time. These conditions are used to assert the function specifications
+ within the source code itself allowing to find bugs more quickly during testing
+ and improving software quality.
+ </p>
+<a name="contract__.introduction.an_example"></a><h6>
+<a name="contract__.introduction.an_example-heading"></a>
+ <a class="link" href="index.html#contract__.introduction.an_example">An Example</a>
+ </h6>
+<p>
+ This example shows how to write a contract for the C++ STL vector <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function using this library. It also shows how to subcontract assuming that
+ the vector class inherits from some <code class="computeroutput"><span class="identifier">pushable</span></code>
+ base class.
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Notes
+ </p>
+ </th>
+<th>
+ <p>
+ This Library Syntax (ISO C++ standard)
+ </p>
+ </th>
+<th>
+ <p>
+ <span class="underline">_N1962_</span> Proposed Syntax (not
+ part of any C++ standard)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="number">1.</span>
+
+
+
+
+<span class="number">2.</span>
+
+<span class="number">3.</span>
+
+<span class="number">4.</span>
+<span class="number">5.</span>
+
+<span class="number">6.</span>
+
+<span class="number">7.</span>
+
+<span class="number">8.</span>
+
+
+
+
+<span class="number">9.</span>
+
+
+
+<span class="number">10.</span>
+
+
+
+
+
+
+
+
+
+
+
+
+
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</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">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="string">"myvector/pushable.hpp"</span>
+
+<span class="comment">// Wrapper class that adds contracts to std::vector.</span>
+<span class="identifier">CONTRACT_CLASS</span><span class="special">(</span>
+<span class="keyword">template</span><span class="special">(</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">)</span>
+<span class="keyword">class</span> <span class="special">(</span><span class="identifier">myvector</span><span class="special">)</span> <span class="identifier">extends</span><span class="special">(</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">)</span> <span class="comment">// Subcontracting.</span>
+<span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">CONTRACT_CLASS_INVARIANT</span><span class="special">(</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span>
+ <span class="comment">// More invariants here...</span>
+ <span class="special">)</span>
+
+ <span class="identifier">CONTRACT_FUNCTION</span><span class="special">(</span>
+ <span class="keyword">public</span> <span class="keyword">void</span> <span class="special">(</span><span class="identifier">push_back</span><span class="special">)(</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&)</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span><span class="special">(</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">()</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">)</span>
+ <span class="identifier">postcondition</span><span class="special">(</span>
+ <span class="keyword">auto</span> <span class="identifier">old_size</span> <span class="special">=</span> <span class="identifier">CONTRACT_OLDOF</span><span class="special">(</span><span class="identifier">size</span><span class="special">()),</span> <span class="comment">// Old value.</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">old_size</span> <span class="special">+</span> <span class="number">1</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">)</span>
+ <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="comment">// Implementation.</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Rest of the class here (with more contracts if needed)...</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="comment">// Extra spaces, newlines, public, etc to better align code with library syntax.</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="string">"myvector/pushable.hpp"</span> <span class="comment">// Base class (subcontracting).</span>
+
+<span class="comment">// Wrapper class that adds contracts to std::vector.</span>
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">myvector</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
+<span class="special">{</span>
+ <span class="identifier">invariant</span> <span class="special">{</span>
+ <span class="identifier">empty</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+ <span class="comment">// More invariants here...</span>
+ <span class="special">}</span>
+
+
+ <span class="keyword">public</span><span class="special">:</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">element</span> <span class="special">)</span>
+ <span class="identifier">precondition</span> <span class="special">{</span>
+ <span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="identifier">max_size</span><span class="special">();</span>
+ <span class="comment">// More preconditions here...</span>
+ <span class="special">}</span>
+ <span class="identifier">postcondition</span> <span class="special">{</span>
+
+ <span class="identifier">size</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">oldof</span> <span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+ <span class="comment">// More postconditions here...</span>
+ <span class="special">}</span>
+ <span class="special">{</span>
+ <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="comment">// Implementation.</span>
+ <span class="special">}</span>
+
+ <span class="comment">// Rest of the class here (with more contracts if needed)...</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">max_size</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">empty</span><span class="special">();</span> <span class="special">}</span>
+ <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">back</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">vector_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<p>
+ Notes:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Include this library header file.
+ </li>
+<li class="listitem">
+ The class signature tokens are passed to the <code class="computeroutput"><span class="identifier">__CONTRACT_CLASS__</span><span class="special">()</span></code> macro in the exact same order as they
+ appear in the class declaration. The parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ around the tokens are mandatory (the create a Boost.Preprocessor
+ <span class="emphasis"><em>sequence</em></span>.
+ </li>
+<li class="listitem">
+ Subcontract from base contracts in <code class="computeroutput"><span class="identifier">pushable</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code> (for <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> in this example). Multiple bases classes
+ can be specified to support subcontracting for multiple-inheritance.
+ </li>
+<li class="listitem">
+ Static class invariants are also supported.
+ </li>
+<li class="listitem">
+ By default, a contract assertion failure terminates the program. However,
+ programmers can customize the action to take on contract assertion failure
+ to throw exceptions, exit the program, etc.
+ </li>
+<li class="listitem">
+ No need for "<code class="computeroutput"><span class="special">;</span></code>"
+ after the macro closing parenthesis "<code class="computeroutput"><span class="special">)</span></code>".
+ </li>
+<li class="listitem">
+ The function signature tokens are passed to the <code class="computeroutput">CONTRACT_FUNCTION<span class="special">()</span></code> macro in the exact same order as they
+ appear in the function declaration. The parenthesis <code class="computeroutput"><span class="special">()</span></code>
+ around the tokens are mandatory (they create a Boost.Preprocessor
+ sequence).
+ </li>
+<li class="listitem">
+ The precondition section <code class="computeroutput"><span class="special">(</span><span class="identifier">precondition</span><span class="special">)</span>
+ <span class="special">({...})</span></code> and the postcondition section
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">postcondition</span><span class="special">)</span> <span class="special">({...})</span></code>
+ can both be omitted, the body section <code class="computeroutput"><span class="special">(</span><span class="identifier">body</span><span class="special">)</span> <span class="special">({...})</span></code> is mandatory instead.
+ </li>
+<li class="listitem">
+ Using <code class="computeroutput">CONTRACT_OLDOF</code>,
+ postconditions can access expressions' old values (i.e., the value the
+ epxressions had before the execution of the body). These old values are
+ stored in the specified variables that can be used to assert the postconditions.
+ (The specified expressions must evaluate to a type with an accessible copy
+ constructor so the library can copy the expression value before the function
+ body is executed.)
+ </li>
+<li class="listitem">
+ The body specifies the original function definition. Instead of <code class="computeroutput"><span class="special">{</span> <span class="identifier">vector_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">element</span><span class="special">);</span> <span class="special">}</span></code>, <code class="computeroutput"><span class="string">" ;"</span></code> can be used to separate the
+ function definition from its declaration, or <code class="computeroutput"><span class="string">"
+ = 0;"</span></code> can be used to write contracts for pure virtual
+ functions.
+ </li>
+</ol></div>
+<p>
+ When the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ function is called:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ First, the class invariants and the function preconditions are checked.
+ </li>
+<li class="listitem">
+ Then, the function body is executed.
+ </li>
+<li class="listitem">
+ Lastly, the class invariants and function postconditions are checked.
+ </li>
+</ol></div>
+<p>
+ For example, if there is a bug in the function caller for which <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code>
+ is called when <code class="computeroutput"><span class="identifier">myvector</span></code> size
+ is equal to <code class="computeroutput"><span class="identifier">max_size</span><span class="special">()</span></code>
+ then the execution will be interrupted reporting a failure of the first assertion
+ in the preconditions and it will be evident that the bug is in the caller:
+ </p>
+<pre class="programlisting">precondition: terminate called after throwing an instance of 'contract::failure'
+ what(): precondition "size() < max_size()" failed at myvector.cpp:20
+Aborted
+</pre>
+<p>
+ Instead, if there is a bug in the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> implementation for which <code class="computeroutput"><span class="identifier">myvector</span></code>
+ size is not increased by 1 after <code class="computeroutput"><span class="identifier">element</span></code>
+ has been added to the vector by the function body then the execution will be
+ interrupted reporting a failure of the first assertion in the postconditions
+ and it will be evident that the bug is in the <code class="computeroutput"><span class="identifier">push_back</span><span class="special">()</span></code> function implementation:
+ </p>
+<pre class="programlisting">postcondition: terminate called after throwing an instance of 'contract::failure'
+ what(): postcondition "size() == old_size + 1" failed at myvector.cpp:20
+Aborted
+</pre>
+<p>
+ Note how the library error messages contain enough information to uniquely
+ identify the failure point: contract type (precondition, postcondition, etc),
+ assertion text, file name, and line number.
+ </p>
+<a name="contract__.introduction.compilers_and_platforms"></a><h6>
+<a name="contract__.introduction.compilers_and_platforms-heading"></a>
+ <a class="link" href="index.html#contract__.introduction.compilers_and_platforms">Compilers and
+ Platforms</a>
+ </h6>
+<p>
+ This library is implemented using both preprocessor (Boost.Preprocessor)
+ and template (Boost.MPL)
+ metaprogramming. The library also uses templates with partial specializations
+ and function pointer types (to implement an interface similar to the one of
+ Boost.Function).
+ As a consequence, this library is fairly demanding on compilers compliance
+ with the ISO C++ standard. At present, this library has been successfully compiled
+ and tested on the following compilers and platforms:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ GCC 4.2.4 on Ubuntu Linux.
+ </li>
+<li class="listitem">
+ Microsoft Visual C++ 8.0 (MSVC 14) on Windows XP.
+ </li>
+<li class="listitem">
+ GCC 3.4.4 on Cygwin.
+ </li>
+</ol></div>
+<p>
+ (No other compiler was tried thus far.)
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id808260" href="#id808260" class="para">1</a>] </sup>
+ <span class="emphasis"><em>Design by Contract</em></span> is a registered trademark of Eiffel Software.
+ </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: May 31, 2011 at 15:17:03 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="contract__/getting_started.html"><img src="images/next.png" alt="Next"></a></div>
+</body>
+</html>
==============================================================================
--- (empty file)
+++ sandbox/contract/libs/contract/doc/html/reference.html 2011-05-31 14:35:22 EDT (Tue, 31 May 2011)
@@ -0,0 +1,234 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Reference</title>
+<link rel="stylesheet" href="doc/html/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Contract++ 0.3.490">
+<link rel="up" href="index.html" title="Contract++ 0.3.490">
+<link rel="prev" href="contract__/Grammar.html" title="Appendix: Grammar">
+<link rel="next" href="contract/failure.html" title="Class failure">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract__/Grammar.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/failure.html"><img src="images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="reference"></a>Reference</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/constructor.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/destructor.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/from.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonmember_function.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonstatic_member_function.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/state.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/static_member_function.hpp></span></dt>
+<dt><span class="section">Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.assert_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/assert.hpp></h3></div></div></div>
+<p>Facilities to assert contract conditions and specify actions to take in case of contract failure. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_ASSERT.html" title="Macro CONTRACT_ASSERT">CONTRACT_ASSERT</a>(boolean_condition)
+<a class="link" href="CONTRACT_ASSERT_MSG.html" title="Macro CONTRACT_ASSERT_MSG">CONTRACT_ASSERT_MSG</a>(boolean_condition, string_description)</pre>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">class</span> <a class="link" href="contract/failure.html" title="Class failure">failure</a><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">__ContractFailedHandler__</span> <a class="link" href="contract/contract_failed_handler.html" title="Type definition contract_failed_handler"><span class="identifier">contract_failed_handler</span></a><span class="special">;</span>
+ <span class="identifier">contract_failed_handler</span> <a class="link" href="contract/set_block_invariant_failed.html" title="Function set_block_invariant_failed"><span class="identifier">set_block_invariant_failed</span></a><span class="special">(</span><span class="identifier">contract_failed_handler</span><span class="special">)</span><span class="special">;</span>
+ <span class="keyword">void</span> <a class="link" href="contract/block_invariant_failed.html" title="Function block_invariant_failed"><span class="identifier">block_invariant_failed</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">contract_failed_handler</span> <a class="link" href="contract/set_class_invariant_failed.html" title="Function set_class_invariant_failed"><span class="identifier">set_class_invariant_failed</span></a><span class="special">(</span><span class="identifier">contract_failed_handler</span><span class="special">)</span><span class="special">;</span>
+ <span class="keyword">void</span> <a class="link" href="contract/class_invariant_failed.html" title="Function class_invariant_failed"><span class="identifier">class_invariant_failed</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">contract_failed_handler</span> <a class="link" href="contract/set_precondition_failed.html" title="Function set_precondition_failed"><span class="identifier">set_precondition_failed</span></a><span class="special">(</span><span class="identifier">contract_failed_handler</span><span class="special">)</span><span class="special">;</span>
+ <span class="keyword">void</span> <a class="link" href="contract/precondition_failed.html" title="Function precondition_failed"><span class="identifier">precondition_failed</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+ <span class="identifier">contract_failed_handler</span> <a class="link" href="contract/set_postcondition_failed.html" title="Function set_postcondition_failed"><span class="identifier">set_postcondition_failed</span></a><span class="special">(</span><span class="identifier">contract_failed_handler</span><span class="special">)</span><span class="special">;</span>
+ <span class="keyword">void</span> <a class="link" href="contract/postcondition_failed.html" title="Function postcondition_failed"><span class="identifier">postcondition_failed</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">from</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.block_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/block.hpp></h3></div></div></div>
+<p>Assert block (and loop) invariants and loop variants. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_ASSERT_BLOCK_INVARIANT.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT">CONTRACT_ASSERT_BLOCK_INVARIANT</a>(boolen_condition)
+<a class="link" href="CONTRACT_ASSERT_BLOCK_INVARIANT_MSG.html" title="Macro CONTRACT_ASSERT_BLOCK_INVARIANT_MSG">CONTRACT_ASSERT_BLOCK_INVARIANT_MSG</a>(boolean_condition, string_description)
+<a class="link" href="CONTRACT_ASSERT_LOOP_VARIANT.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT">CONTRACT_ASSERT_LOOP_VARIANT</a>(integer_expression)
+<a class="link" href="CONTRACT_ASSERT_LOOP_VARIANT_MSG.html" title="Macro CONTRACT_ASSERT_LOOP_VARIANT_MSG">CONTRACT_ASSERT_LOOP_VARIANT_MSG</a>(integer_expression, string_description)
+<a class="link" href="CONTRACT_INIT_LOOP_VARIANT.html" title="Macro CONTRACT_INIT_LOOP_VARIANT">CONTRACT_INIT_LOOP_VARIANT</a></pre>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">__Integer__</span> <a class="link" href="contract/loop_variant_type.html" title="Type definition loop_variant_type"><span class="identifier">loop_variant_type</span></a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.body_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/body.hpp></h3></div></div></div>
+<p>Macros used to name the body function when separating its definition from the contract declaration.</p>
+<p>For example, these macros are used when function body definitions are implemented in a source file ".cpp" while the function and contract declarations are given in separate header file ".hpp".</p>
+<p><span class="bold"><strong>See:</strong></span> Examples and more information in the Tutorial section. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_CONSTRUCTOR_BODY.html" title="Macro CONTRACT_CONSTRUCTOR_BODY">CONTRACT_CONSTRUCTOR_BODY</a>(class_type, class_name)
+<a class="link" href="CONTRACT_DESTRUCTOR_BODY.html" title="Macro CONTRACT_DESTRUCTOR_BODY">CONTRACT_DESTRUCTOR_BODY</a>(class_type, class_name)
+<a class="link" href="CONTRACT_BODY.html" title="Macro CONTRACT_BODY">CONTRACT_BODY</a>(function_name)</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.config_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/config.hpp></h3></div></div></div>
+<p>Macros to change some of the library compile-time configuration.</p>
+<p>Configuration macros can be #defined by the user to change some of the library behaviour. If the user does not #define these macros, the library uses proper default values:</p>
+<pre class="programlisting"> <span class="preprocessor">#ifndef</span> <span class="identifier">CONTRACT_CONFIG_SOMETHING</span>
+ <span class="preprocessor"># define</span> <span class="identifier">CONTRACT_CONFIG_SOMETHING</span> <span class="identifier">some</span><span class="special">-</span><span class="keyword">default</span><span class="special">-</span><span class="identifier">value</span>
+ <span class="preprocessor">#endif</span>
+</pre>
+<p><span class="bold"><strong>Note:</strong></span> It is strongly recommended not to changed the configuration macro default values unless strictly necessary. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_CONFIG_MAX_FUNCTION_ARITY.html" title="Macro CONTRACT_CONFIG_MAX_FUNCTION_ARITY">CONTRACT_CONFIG_MAX_FUNCTION_ARITY</a>
+<a class="link" href="CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE.html" title="Macro CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE">CONTRACT_CONFIG_MAX_MULTIPLE_INHERITANCE</a></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.constructor_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/constructor.hpp></h3></div></div></div>
+<p>Class template used to write contracts for constructors. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</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">class</span> <a class="link" href="contract/constructor.html" title="Class template constructor">constructor</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract.hpp></h3></div></div></div>
+<p>Include the entire library.</p>
+<pre class="programlisting"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">contract</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>It is recommended to include the library this way instead of including the single header files from the <code class="computeroutput">"contract/"</code> directory.</p>
+<p><span class="bold"><strong>Metaprogramming Symbols</strong></span></p>
+<p>This documentation source code indicates some metaprogramming constructs using special mixed-case symbols prefixed and postfixed by double underscores "__". These symbols are then expanded to actual code in the documentation text. For example: </p>
+<pre class="programlisting"> <span class="comment">// Metaprogramming conventions for this documentation.</span>
+ <span class="identifier">__AMetaprogrammingConstruct__</span>
+ <span class="identifier">__AMetaprogrammingConstructWithParameters__</span><span class="special"><</span> <span class="identifier">X</span><span class="special">,</span> <span class="identifier">Y</span><span class="special">,</span> <span class="identifier">Z</span> <span class="special">></span>
+</pre>
+<p> In this convention, these metaporgramming constructs are <span class="bold"><strong>not</strong></span> templates. They are internally implemented by the library using both preprocessor and template metaprogramming (in a way that is intentionally <span class="emphasis"><em>not</em></span> documented here because it is library implementation specific).</p>
+<p><span class="bold"><strong>See:</strong></span> Getting Started section. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_CHECK_BLOCK_INVARIANT.html" title="Macro CONTRACT_CHECK_BLOCK_INVARIANT">CONTRACT_CHECK_BLOCK_INVARIANT</a>
+<a class="link" href="CONTRACT_CHECK_CLASS_INVARIANT.html" title="Macro CONTRACT_CHECK_CLASS_INVARIANT">CONTRACT_CHECK_CLASS_INVARIANT</a>
+<a class="link" href="CONTRACT_CHECK_PRECONDITION.html" title="Macro CONTRACT_CHECK_PRECONDITION">CONTRACT_CHECK_PRECONDITION</a>
+<a class="link" href="CONTRACT_CHECK_POSTCONDITION.html" title="Macro CONTRACT_CHECK_POSTCONDITION">CONTRACT_CHECK_POSTCONDITION</a></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.destructor_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/destructor.hpp></h3></div></div></div>
+<p>Class template used to write contracts for destructors. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</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">class</span> <a class="link" href="contract/destructor.html" title="Class template destructor">destructor</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.from_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/from.hpp></h3></div></div></div>
+<p>Context from which the contract failure was generated. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">enum</span> <a class="link" href="contract/from.html" title="Type from">from</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.macros_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/macros.hpp></h3></div></div></div>
+<p>Contract macros.</p>
+<p>These macros are the primary tools to write contracts.</p>
+<p><span class="bold"><strong>See:</strong></span> See the Tutorial section for examples. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_INVARIANT.html" title="Macro CONTRACT_INVARIANT">CONTRACT_INVARIANT</a>(sequence)
+<a class="link" href="CONTRACT_CONSTRUCTOR.html" title="Macro CONTRACT_CONSTRUCTOR">CONTRACT_CONSTRUCTOR</a>(sequence)
+<a class="link" href="CONTRACT_DESTRUCTOR.html" title="Macro CONTRACT_DESTRUCTOR">CONTRACT_DESTRUCTOR</a>(sequence)
+<a class="link" href="CONTRACT_FUNCTION.html" title="Macro CONTRACT_FUNCTION">CONTRACT_FUNCTION</a>(sequence)</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonmember_function_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonmember_function.hpp></h3></div></div></div>
+<p>Class template used to write contracts non-member functions. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</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">class</span> <a class="link" href="contract/nonmember_function.html" title="Class template nonmember_function">nonmember_function</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.nonstatic_member_function_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/nonstatic_member_function.hpp></h3></div></div></div>
+<p>Class template used to write contracts for non-static member functions. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</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">typename</span> BaseContractClass1 <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="special">...</span> <span class="special">,</span>
+ <span class="keyword">typename</span> BaseContractClassM <span class="special">=</span> <span class="keyword">void</span><span class="special">></span>
+ <span class="keyword">class</span> <a class="link" href="contract/nonstatic_member_function.html" title="Class template nonstatic_member_function">nonstatic_member_function</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.old_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/old.hpp></h3></div></div></div>
+<p>Facilities to support old values in postconditions.</p>
+<p>Postconditions can access old variable values (before body executions) for types tagged <code class="computeroutput"><a class="link" href="contract/copyable.html" title="Class template copyable">contract::copyable</a></code>. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_OLDOF.html" title="Macro CONTRACT_OLDOF">CONTRACT_OLDOF</a>(variable_name)</pre>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span> <span class="keyword">class</span> <a class="link" href="contract/copyable.html" title="Class template copyable">copyable</a><span class="special">;</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span> <span class="keyword">class</span> <a class="link" href="contract/copy.html" title="Class template copy">copy</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.state_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/state.hpp></h3></div></div></div>
+<p>Augmented object state internally used by the library. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">class</span> <a class="link" href="contract/state.html" title="Class state">state</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.static_member_function_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/static_member_function.hpp></h3></div></div></div>
+<p>Class template used to write contracts for static member functions. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</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">class</span> <a class="link" href="contract/static_member_function.html" title="Class template static_member_function">static_member_function</a><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.E:.sandbox.contractpp.trunk.doc.qbk.src.contract.wrap_hpp"></a>Header <E:/sandbox/contractpp/trunk/doc/qbk/src/contract/wrap.hpp></h3></div></div></div>
+<p>Utilities to pass commas within macro parameters. </p>
+<pre class="synopsis">
+
+<a class="link" href="CONTRACT_WRAP_TYPE.html" title="Macro CONTRACT_WRAP_TYPE">CONTRACT_WRAP_TYPE</a>(parenthesized_type)</pre>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">contract</span> <span class="special">{</span>
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span> <span class="keyword">struct</span> <a class="link" href="contract/wrap.html" title="Struct template wrap">wrap</a><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></span> <span class="keyword">struct</span> <a class="link" href="contract/wrap_void_T__id437104.html" title="Struct template wrap<void(T)>">wrap</a><span class="special"><</span><span class="keyword">void</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">></span><span class="special">;</span>
+<span class="special">}</span></pre>
+</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 © 2009, 2010 Lorenzo Caminiti<p>
+ Distributed under the Contract++ Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="contract__/Grammar.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="contract/failure.html"><img src="images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>