...one of the most highly
regarded and expertly designed C++ library projects in the
world.

— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards

boost::make_recursive_variant — Simplifies declaration of recursive `variant` types.

template<typenameT1,typenameT2 =unspecified, ...,typenameTN =unspecified>classmake_recursive_variant {public:// typestypedefboost::variant<unspecified> type; };

`type` has behavior equivalent in every respect to
some `variant< U1, U2, ..., UN >`, where each type
`U i` is the result of the
corresponding type

- If
`T`is*i*`boost::recursive_variant_`then:`variant< U1, U2, ..., UN >`; - Else if
`T`is of the form*i*`X *`then:`substitute(X) *`; - Else if
`T`is of the form*i*`X &`then:`substitute(X) &`; - Else if
`T`is of the form*i*`R (*)( X1, X2, ..., XN )`then:`substitute(R) (*)( substitute(X1), substitute(X2), ..., substitute(XN) )`; - Else if
`T`is of the form*i*`F < X1, X2, ..., XN >`then:`F< substitute(X1), substitute(X2), ..., substitute(XN) >`; - Else:
`T`.*i*

Note that cv-qualifiers are preserved and that the actual process is generally a bit more complicated. However, the above does convey the essential idea as well as describe the extent of the substititions.

Use of `make_recursive_variant` is demonstrated in
the section called “Recursive types with `make_recursive_variant`”.

**Portability**: Due to standard
conformance issues in several compilers,
`make_recursive_variant` is not universally supported. On
these compilers the library indicates its lack of support via the
definition of the preprocessor symbol
`BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT`.

Copyright © 2002, 2003 Eric Friedman, Itay Maman |