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 master branch, built from commit dcf1600e63.
PrevUpHomeNext

ignore_unused

Header <boost/core/ignore_unused.hpp>
Acknowledgements

Authors

  • Adam Wulkiewicz

The header <boost/core/ignore_unused.hpp> defines the function template boost::ignore_unused(). It may be used to suppress the "unused variable" or "unused local typedefs" compiler warnings when the variable or typedef can't be removed or commented out, e.g. when some blocks of the code are conditionally activated. C++11 variadic templates are used if they're supported, otherwise they're emulated with overloads.

boost::ignore_unused(v1, v2, v3);
boost::ignore_unused<T1, T2, T3>();
int fun( int foo, int bar )
{
    boost::ignore_unused(bar);
#ifdef ENABLE_DEBUG_OUTPUT
    if ( foo < bar )
        std::cerr << "warning! foo < bar";
#endif
    return foo + 2;
}

boost::ignore_unused() was contributed by Adam Wulkiewicz.


PrevUpHomeNext