print.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef BOOST_MPL_PRINT_HPP_INCLUDED
  2. #define BOOST_MPL_PRINT_HPP_INCLUDED
  3. // Copyright David Abrahams 2003
  4. // Copyright Aleksey Gurtovoy 2004
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // See http://www.boost.org/libs/mpl for documentation.
  11. // $Id$
  12. // $Date$
  13. // $Revision$
  14. #include <boost/mpl/aux_/config/msvc.hpp>
  15. #include <boost/mpl/identity.hpp>
  16. namespace boost { namespace mpl {
  17. namespace aux {
  18. #if defined(BOOST_MSVC)
  19. # pragma warning(push, 3)
  20. // we only want one warning from MSVC, so turn off the other one
  21. # pragma warning(disable: 4307)
  22. #elif defined(__MWERKS__)
  23. # pragma warn_hidevirtual on
  24. struct print_base { virtual void f() {} };
  25. #endif
  26. #if defined(__EDG_VERSION__)
  27. template <class T>
  28. struct dependent_unsigned
  29. {
  30. static const unsigned value = 1;
  31. };
  32. #endif
  33. } // namespace aux
  34. template <class T>
  35. struct print
  36. : mpl::identity<T>
  37. #if defined(__MWERKS__)
  38. , aux::print_base
  39. #endif
  40. {
  41. #if defined(__clang__)
  42. # pragma clang diagnostic push
  43. # pragma clang diagnostic ignored "-Wc++11-extensions"
  44. const int m_x = 1 / (sizeof(T) - sizeof(T));
  45. # pragma clang diagnostic pop
  46. #elif defined(BOOST_MSVC)
  47. enum { n = sizeof(T) + -1 };
  48. #elif defined(__MWERKS__)
  49. void f(int);
  50. #else
  51. enum {
  52. n =
  53. # if defined(__EDG_VERSION__)
  54. aux::dependent_unsigned<T>::value > -1
  55. # else
  56. sizeof(T) > -1
  57. # endif
  58. };
  59. #endif
  60. };
  61. #if defined(BOOST_MSVC)
  62. # pragma warning(pop)
  63. #elif defined(__MWERKS__)
  64. # pragma warn_hidevirtual reset
  65. #endif
  66. }}
  67. #endif // BOOST_MPL_PRINT_HPP_INCLUDED