| Home | Libraries | People | FAQ | More

## Macro BOOST_CONTRACT_BASE_TYPES

BOOST_CONTRACT_BASE_TYPES — Used to program the `typedef` that lists 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 functions 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_BASE_TYPES(BASES) base_types;
        #undef BASES

        ...
    };

This `typedef` must be `public` unless `boost::contract::access` is 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 (see No Macros).