/** @file
Program contracts for public functions (including subcontracting).
-Overloads handle public functions that are static, virtual void, virtual non-void, overriding void, and overriding non-void.
+The different overloads handle public functions that are static, virtual void,
+virtual non-void, overriding void, and overriding non-void.
*/
#include <boost/contract/core/config.hpp>
#endif
#include <boost/preprocessor/control/expr_iif.hpp>
#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
namespace boost { namespace contract {
This template parameter must be explicitly specified for static
public functions (because they have no object @c this so there
is no function argument from which this type template parameter
- can be deduced by this library).
+ can be automatically deduced by C++).
-@return The result of this function must be explicitly assigned to a variable of
- type @RefClass{boost::contract::check} declared locally just before the
- code of the static function body (otherwise this library will generate a
+@return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code of
+ the static public function body (otherwise this library will generate a
run-time error, see @RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<class Class>
(Usually this template parameter is automatically deduced by C++
and it does not need to be explicitly specified by programmers.)
-@return The result of this function must be explicitly assigned to a variable of
- type @RefClass{boost::contract::check} declared locally just before the
- code of the public function body (otherwise this library will generate a
+@return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code of
+ the public function body (otherwise this library will generate a
run-time error, see @RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<class Class>
C++ and it does not need to be explicitly specified by
programmers.)
- @return The result of this function must be explicitly assigned to a
- variable of type @RefClass{boost::contract::check} declared locally
- just before the code of the public function body (otherwise this
- library will generate a run-time error, see
+ @return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code
+ of the public function body (otherwise this library will generate a
+ run-time error, see
@RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<class Class>
C++ and it does not need to be explicitly specified by
programmers.)
- @return The result of this function must be explicitly assigned to a
- variable of type @RefClass{boost::contract::check} declared locally
- just before the code of the public function body (otherwise this
- library will generate a run-time error, see
+ @return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code
+ of the public function body (otherwise this library will generate a
+ run-time error, see
@RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<typename VirtualResult, class Class>
BOOST_CONTRACT_DETAIL_DECL_OVERRIDING_PUBLIC_FUNCTION_Z(z, \
arity, /* is_friend = */ 0, has_virtual_result, \
Override, VirtualResult, F, Class, Args, \
- v, r, f, obj, args \
+ v, r, /* f */ BOOST_PP_EMPTY(), obj, args \
) { \
BOOST_PP_IIF(BOOST_CONTRACT_PUBLIC_FUNCTIONS_IMPL_, \
{ /* extra scope paren to expand STATIC_STATIC emu on same line */ \
@RefClass{boost::contract::virtual_}<c>*</c> and default value
@c 0 from the enclosing public function override.
@param f A pointer to the enclosing public function override declaring
- the contract.
+ the contract (but see @RefSect{advanced.function_overloads,
+ Function Overloads}).
@param obj The object @c this from the scope of the enclosing public
function override declaring the contract.
This object might be mutable, @c const, @c volatile, or
appear in the enclosing function declaration), but excluding the
trailing argument @c v.
- @tparam Override The type <c>override_<i>function-name</i></c> declared
- using the @RefMacro{BOOST_CONTRACT_OVERRIDE} or related
- macros.
+ @tparam Override The type trait <c>override_<i>function-name</i></c>
+ declared using the @RefMacro{BOOST_CONTRACT_OVERRIDE} or
+ related macros.
This template parameter must be explicitly specified
(because there is no function argument from which it can
be automatically deduced by C++).
override declaring the contract.
(Usually this template parameter is automatically deduced by
C++ and it does not need to be explicitly specified by
- programmers, but see
- @RefSect{advanced.function_overloads, Function Overloads}.)
+ programmers.)
@tparam Class The type of the class containing the virtual public function
declaring the contract.
(Usually this template parameter is automatically deduced by
by C++ and they do not need to be explicitly specified by
programmers.)
- @return The result of this function must be explicitly assigned to a
- variable of type @RefClass{boost::contract::check} declared locally
- just before the code of the public function body (otherwise this
- library will generate a run-time error, see
+ @return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code
+ of the public function body (otherwise this library will generate a
+ run-time error, see
@RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<class Override, typename F, class Class, typename... Args>
programmers must set it to the actual value being returned by
the function at each @c return statement.
@param f A pointer to the enclosing public function override declaring
- the contract.
+ the contract (but see @RefSect{advanced.function_overloads,
+ Function Overloads}).
@param obj The object @c this from the scope of the enclosing public
function override declaring the contract.
This object might be mutable, @c const, @c volatile, or
appear in the enclosing function declaration), but excluding the
trailing argument @c v.
- @tparam Override The type <c>override_<i>function-name</i></c> declared
- using the @RefMacro{BOOST_CONTRACT_OVERRIDE} or related
- macros.
+ @tparam Override The type trait <c>override_<i>function-name</i></c>
+ declared using the @RefMacro{BOOST_CONTRACT_OVERRIDE} or
+ related macros.
This template parameter must be explicitly specified
(because there is no function argument from which it can
be automatically deduced by C++).
override declaring the contract.
(Usually this template parameter is automatically deduced by
C++ and it does not need to be explicitly specified by
- programmers, but see
- @RefSect{advanced.function_overloads,
- Function Overloads}.)
+ programmers.)
@tparam Class The type of the class containing the virtual public function
declaring the contract.
(Usually this template parameter is automatically deduced by
by C++ and they do not need to be explicitly specified by
programmers.)
- @return The result of this function must be explicitly assigned to a
- variable of type @RefClass{boost::contract::check} declared locally
- just before the code of the public function body (otherwise this
- library will generate a run-time error, see
+ @return The result of this function must be assigned to a variable of type
+ @RefClass{boost::contract::check} declared explicitly (i.e., without
+ using C++11 @c auto declarations) and locally just before the code
+ of the public function body (otherwise this library will generate a
+ run-time error, see
@RefMacro{BOOST_CONTRACT_ON_MISSING_CHECK_DECL}).
*/
template<class Override, typename VirtualResult, typename F, class Class,