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_VARIANT_ENUM_PARAMS

BOOST_VARIANT_ENUM_PARAMS — Enumerate parameters for use with variant.

Synopsis

// In header: <boost/variant/variant_fwd.hpp>

BOOST_VARIANT_ENUM_PARAMS(param)

Description

When variadic templates are available and BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES is not defined, expands to variadic template list in the following manner:

            BOOST_VARIANT_ENUM_PARAMS(T)                    => T0, TN...
            BOOST_VARIANT_ENUM_PARAMS(class T)              => class T0, class... TN
            BOOST_VARIANT_ENUM_PARAMS(class Something)      => class Something0, class... SomethingN
            BOOST_VARIANT_ENUM_PARAMS(typename Something)   => typename Something0, typename... SomethingN
            BOOST_VARIANT_ENUM_PARAMS(Something)            => Something0, SomethingN...
            BOOST_VARIANT_ENUM_PARAMS(Something)            => Something0, SomethingN...
        

Otherwise expands to a comma-separated sequence of length BOOST_VARIANT_LIMIT_TYPES, where each element in the sequence consists of the concatenation of param with its zero-based index into the sequence. That is, param ## 0, param ## 1, ..., param ## BOOST_VARIANT_LIMIT_TYPES - 1.

Rationale: This macro greatly simplifies for the user the process of declaring variant types in function templates or explicit partial specializations of class templates, as shown in the tutorial.


PrevUpHomeNext