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 a snapshot of the develop branch, built from commit d4128b739e.
PrevUpHomeNext

Macro BOOST_VMD_IS_EMPTY

BOOST_VMD_IS_EMPTY — Tests whether its input is empty or not.

Synopsis

// In header: <boost/vmd/is_empty.hpp>

BOOST_VMD_IS_EMPTY(...)

Description

The macro checks to see if the input is empty or not. It returns 1 if the input is empty, else returns 0.

The macro is a variadic macro taking any input. For the VC++8 compiler (VS2005) the macro takes a single parameter of input to check.

For all levels of C++ prior to C++20 the macro is not perfect, and can not be so. The problem area is if the input to be checked is a function-like macro name, in which case either a compiler error can result or a false result can occur.

For C++20, with its support for the new VA_OPT preprocessor construct, the macro will always work correctly no matter what the variadic input, and is therefore 100% reliable.

This macro is a replacement, using variadic macro support, for the undocumented macro BOOST_PP_IS_EMPTY in the Boost PP library. The code is taken from a posting by Paul Mensonides of a variadic version for BOOST_PP_IS_EMPTY, and changed in order to also support VC++. The code for the C++20 implementation of the macro, using the VA_OPT preprocessor construct, is the author's own and reuses code added to the Boost preprocessor library by this author.

... = variadic input, for VC++8 this must be a single parameter

returns = 1 if the input is empty, 0 if it is not

It is recommended to append BOOST_PP_EMPTY() to whatever input is being tested in order to avoid possible warning messages from some compilers about no parameters being passed to the macro when the input is truly empty.


PrevUpHomeNext