print.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: print.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
  12. // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
  13. // $Revision: 49267 $
  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(BOOST_MSVC)
  42. enum { n = sizeof(T) + -1 };
  43. #elif defined(__MWERKS__)
  44. void f(int);
  45. #else
  46. enum {
  47. n =
  48. # if defined(__EDG_VERSION__)
  49. aux::dependent_unsigned<T>::value > -1
  50. # else
  51. sizeof(T) > -1
  52. # endif
  53. };
  54. #endif
  55. };
  56. #if defined(BOOST_MSVC)
  57. # pragma warning(pop)
  58. #elif defined(__MWERKS__)
  59. # pragma warn_hidevirtual reset
  60. #endif
  61. }}
  62. #endif // BOOST_MPL_PRINT_HPP_INCLUDED