Class template make_recursive_variant

boost::make_recursive_variantSimplifies declaration of recursive variant types.


Synopsis

template<typename T1, typename T2 = unspecified, ..., 
         typename TN = unspecified> 
class make_recursive_variant {
public:
  // types
  typedef boost::variant< unspecified > type;
};

Description

type has behavior equivalent in every respect to some variant< U1, U2, ..., UN >, where each type Ui>i is the result of the corresponding type Ti  undergone a transformation function. The following pseudo-code specifies the behavior of this transformation (call it substitute):

  • If Ti is boost::recursive_variant_ then: variant< U1, U2, ..., UN >;

  • Else if Ti is of the form X * then: substitute(X) *;

  • Else if Ti is of the form X & then: substitute(X) &;

  • Else if Ti is of the form R (*)( X1, X2, ..., XN ) then: substitute(R) (*)( substitute(X1), substitute(X2), ..., substitute(XN) );

  • Else if Ti is of the form F < X1, X2, ..., XN > then: F< substitute(X1), substitute(X2), ..., substitute(XN) >;

  • Else: Ti

Note: cv-qualifiers are preserved and 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 class="emphasis">.


Copyright © 2002, 2003 Eric Friedman, Itay Maman
Permission to copy, use, sell and distribute this software is granted provided this copyright notice appears in all copies. Permission to modify the code and to distribute modified code is granted provided this copyright notice appears in all copies, and a notice that the code was modified is included with the copyright notice. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

Top