unused.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2018 Kohei Takahashi
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(BOOST_FUSION_SUPPORT_UNUSED_20070305_1038)
  8. #define BOOST_FUSION_SUPPORT_UNUSED_20070305_1038
  9. #include <boost/fusion/support/config.hpp>
  10. #include <iosfwd>
  11. #if defined(BOOST_MSVC)
  12. # pragma warning(push)
  13. # pragma warning(disable: 4522) // multiple assignment operators specified warning
  14. #endif
  15. #define BOOST_FUSION_UNUSED_HAS_IO
  16. namespace boost { namespace fusion
  17. {
  18. struct unused_type
  19. {
  20. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  21. BOOST_DEFAULTED_FUNCTION(
  22. unused_type() BOOST_FUSION_NOEXCEPT_ON_DEFAULTED,
  23. {
  24. })
  25. template <typename T>
  26. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  27. unused_type(T const&) BOOST_NOEXCEPT
  28. {
  29. }
  30. };
  31. BOOST_CONSTEXPR_OR_CONST unused_type unused = unused_type();
  32. namespace detail
  33. {
  34. struct unused_only
  35. {
  36. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  37. unused_only(unused_type const&) BOOST_NOEXCEPT {}
  38. };
  39. }
  40. BOOST_CONSTEXPR
  41. inline std::ostream& operator<<(std::ostream& out, detail::unused_only const&) BOOST_NOEXCEPT
  42. {
  43. return out;
  44. }
  45. BOOST_CONSTEXPR
  46. inline std::istream& operator>>(std::istream& in, unused_type&) BOOST_NOEXCEPT
  47. {
  48. return in;
  49. }
  50. }}
  51. #if defined(BOOST_MSVC)
  52. # pragma warning(pop)
  53. #endif
  54. #endif