unused.hpp 1.8 KB

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