Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards



BOOST_VMD_IS_UNARY_D — Determines if the sequence has only a single element, referred to as a single-element sequence. Re-entrant version.


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

BOOST_VMD_IS_UNARY_D(d, sequence)


d = The next available BOOST_PP_WHILE iteration.
sequence = a sequence

returns = 1 if the sequence is a single-element sequence, else returns 0.

If the size of a sequence is known it is faster comparing that size to be equal to one to find out if the sequence is single-element. But if the size of the sequence is not known it is faster calling this macro than getting the size and doing the previously mentioned comparison in order to determine if the sequence is single-element or not.