Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Macro BOOST_CONTRACT_BASE_TYPES

BOOST_CONTRACT_BASE_TYPES — Used to program a typedef listing the bases of a derived class.

Synopsis

// In header: <boost/contract/base_types.hpp>

BOOST_CONTRACT_BASE_TYPES(...)

Description

In order to support subcontracting, a derived class that specifies contracts for one or more overriding public function must declare a typedef named base_types (or BOOST_CONTRACT_BASES_TYPEDEF) using this macro.

class u :
    #define BASES public b, protected virtual w1, private w2
    BASES
{
    friend class boost::contract:access;

    typedef BOOST_CONTRACT_BASES(BASES) base_types;
    #undef BASES

    ...
};

This typedef must be public if boost::contract::access is not used.

See Also:

Base Classes

Parameters:

...

Comma separated list of base classes. Each base must explicitly specify its access specifier public, protected, or private, and also virtual when present (this not always required in C++ instead). There is a limit of about 20 maximum bases that can be listed (because of similar limits in Boost.MPL internally used by this library). This is a variadic macro parameter, on compilers that do not support variadic macros, the typedef for base classes can be programmed manually without using this macro.


PrevUpHomeNext