unused.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  26. BOOST_DEFAULTED_FUNCTION(
  27. unused_type(unused_type const&) BOOST_FUSION_NOEXCEPT_ON_DEFAULTED,
  28. {
  29. })
  30. template <typename T>
  31. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  32. unused_type(T const&) BOOST_NOEXCEPT
  33. {
  34. }
  35. BOOST_FUSION_CONSTEXPR_THIS BOOST_FUSION_GPU_ENABLED
  36. unused_type const&
  37. operator=(unused_type const&) const BOOST_NOEXCEPT
  38. {
  39. return *this;
  40. }
  41. };
  42. BOOST_CONSTEXPR_OR_CONST unused_type unused = unused_type();
  43. namespace detail
  44. {
  45. struct unused_only
  46. {
  47. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  48. unused_only(unused_type const&) BOOST_NOEXCEPT {}
  49. };
  50. }
  51. BOOST_CONSTEXPR
  52. inline std::ostream& operator<<(std::ostream& out, detail::unused_only const&) BOOST_NOEXCEPT
  53. {
  54. return out;
  55. }
  56. BOOST_CONSTEXPR
  57. inline std::istream& operator>>(std::istream& in, unused_type&) BOOST_NOEXCEPT
  58. {
  59. return in;
  60. }
  61. }}
  62. #if defined(BOOST_MSVC)
  63. # pragma warning(pop)
  64. #endif
  65. #endif