2014-06-10 13:25:46 +03:00
|
|
|
[/
|
|
|
|
|
Copyright 2014 Adam Wulkiewicz
|
|
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
|
|
|
|
|
|
|
|
See accompanying file LICENSE_1_0.txt
|
|
|
|
|
or copy at http://boost.org/LICENSE_1_0.txt
|
|
|
|
|
]
|
|
|
|
|
|
2014-06-05 10:48:21 -07:00
|
|
|
[section:ignore_unused ignore_unused]
|
|
|
|
|
|
|
|
|
|
[section Authors]
|
|
|
|
|
|
|
|
|
|
* Adam Wulkiewicz
|
|
|
|
|
|
|
|
|
|
[endsect]
|
|
|
|
|
|
|
|
|
|
[section Header <boost/core/ignore_unused.hpp>]
|
2014-06-02 15:06:53 +02:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
2014-06-10 13:25:46 +03:00
|
|
|
[section Usage]
|
2014-06-02 15:06:53 +02:00
|
|
|
|
2014-06-05 10:48:21 -07:00
|
|
|
``
|
|
|
|
|
boost::ignore_unused(v1, v2, v3);
|
|
|
|
|
boost::ignore_unused<T1, T2, T3>();
|
|
|
|
|
``
|
2014-06-02 15:06:53 +02:00
|
|
|
|
2014-06-10 13:25:46 +03:00
|
|
|
[endsect]
|
|
|
|
|
|
|
|
|
|
[section Example]
|
2014-06-02 15:06:53 +02:00
|
|
|
|
2014-06-05 10:48:21 -07:00
|
|
|
``
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
``
|
|
|
|
|
|
|
|
|
|
[endsect]
|
|
|
|
|
|
2014-06-10 13:25:46 +03:00
|
|
|
[endsect]
|
|
|
|
|
|
2014-06-05 10:48:21 -07:00
|
|
|
[section Acknowledgments]
|
|
|
|
|
|
|
|
|
|
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
|
|
|
|
|
|
|
|
|
|
[endsect]
|
2014-06-02 15:06:53 +02:00
|
|
|
|
|
|
|
|
[endsect]
|