nop.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. /*!
  8. * \file nop.hpp
  9. * \author Andrey Semashev
  10. * \date 30.03.2008
  11. *
  12. * This header contains a function object that does nothing.
  13. */
  14. #ifndef BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_
  15. #define BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_
  16. #include <boost/log/detail/config.hpp>
  17. #include <boost/log/detail/header.hpp>
  18. #ifdef BOOST_HAS_PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. namespace boost {
  22. BOOST_LOG_OPEN_NAMESPACE
  23. //! The function object that does nothing
  24. struct nop
  25. {
  26. typedef void result_type;
  27. void operator() () const BOOST_NOEXCEPT {}
  28. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  29. template< typename... ArgsT >
  30. void operator() (ArgsT const&...) const BOOST_NOEXCEPT {}
  31. #else
  32. template< typename T >
  33. void operator() (T const&) const BOOST_NOEXCEPT {}
  34. template< typename T1, typename T2 >
  35. void operator() (T1 const&, T2 const&) const BOOST_NOEXCEPT {}
  36. template< typename T1, typename T2, typename T3 >
  37. void operator() (T1 const&, T2 const&, T3 const&) const BOOST_NOEXCEPT {}
  38. #endif
  39. };
  40. BOOST_LOG_CLOSE_NAMESPACE // namespace log
  41. } // namespace boost
  42. #include <boost/log/detail/footer.hpp>
  43. #endif // BOOST_LOG_UTILITY_FUNCTIONAL_NOP_HPP_INCLUDED_