blank.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //-----------------------------------------------------------------------------
  2. // boost blank.hpp header file
  3. // See http://www.boost.org for updates, documentation, and revision history.
  4. //-----------------------------------------------------------------------------
  5. //
  6. // Copyright (c) 2003
  7. // Eric Friedman
  8. //
  9. // Distributed under the Boost Software License, Version 1.0. (See
  10. // accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. #ifndef BOOST_BLANK_HPP
  13. #define BOOST_BLANK_HPP
  14. #include "boost/blank_fwd.hpp"
  15. #if !defined(BOOST_NO_IOSTREAM)
  16. #include <iosfwd> // for std::basic_ostream forward declare
  17. #include "boost/detail/templated_streams.hpp"
  18. #endif // BOOST_NO_IOSTREAM
  19. #include "boost/type_traits/integral_constant.hpp"
  20. #include "boost/type_traits/is_empty.hpp"
  21. #include "boost/type_traits/is_pod.hpp"
  22. #include "boost/type_traits/is_stateless.hpp"
  23. namespace boost {
  24. struct blank
  25. {
  26. };
  27. // type traits specializations
  28. //
  29. template <>
  30. struct is_pod< blank >
  31. : boost::true_type
  32. {
  33. };
  34. template <>
  35. struct is_empty< blank >
  36. : boost::true_type
  37. {
  38. };
  39. template <>
  40. struct is_stateless< blank >
  41. : boost::true_type
  42. {
  43. };
  44. // relational operators
  45. //
  46. inline bool operator==(const blank&, const blank&)
  47. {
  48. return true;
  49. }
  50. inline bool operator<=(const blank&, const blank&)
  51. {
  52. return true;
  53. }
  54. inline bool operator>=(const blank&, const blank&)
  55. {
  56. return true;
  57. }
  58. inline bool operator!=(const blank&, const blank&)
  59. {
  60. return false;
  61. }
  62. inline bool operator<(const blank&, const blank&)
  63. {
  64. return false;
  65. }
  66. inline bool operator>(const blank&, const blank&)
  67. {
  68. return false;
  69. }
  70. // streaming support
  71. //
  72. #if !defined(BOOST_NO_IOSTREAM)
  73. BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
  74. inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
  75. BOOST_TEMPLATED_STREAM(ostream, E,T)& out
  76. , const blank&
  77. )
  78. {
  79. // (output nothing)
  80. return out;
  81. }
  82. #endif // BOOST_NO_IOSTREAM
  83. } // namespace boost
  84. #endif // BOOST_BLANK_HPP