...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
BOOST_CONTRACT_OLDOF — Macro typically used to copy an old value expression and assign it to an old value pointer.
// In header: <boost/contract/old.hpp>
BOOST_CONTRACT_OLDOF(...)
The expression expanded by this macro should be assigned to an old value pointer of type boost::contract::old_ptr
or boost::contract::old_ptr_if_copyable
. This is an overloaded variadic macro and it can be used in the following different ways.
From within virtual public functions and public functions overrides:
BOOST_CONTRACT_OLDOF(v, old_expr)
From all other operations:
BOOST_CONTRACT_OLDOF(old_expr)
Where:
v
is the extra parameter of type boost::contract::virtual_
*
and default value 0
from the enclosing virtual public function or public function overrides declaring the contract.
old_expr
is the expression to be evaluated and copied to the old value pointer. (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis, BOOST_CONTRACT_OLDOF(v, (old_expr))
will always work.)
On compilers that do not support variadic macros, programmers can manually copy old value expressions without using this macro (see No Macros).
See Also: