na.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef BOOST_MPL_AUX_NA_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_NA_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2001-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/bool.hpp>
  14. #include <boost/mpl/aux_/na_fwd.hpp>
  15. #include <boost/mpl/aux_/config/msvc.hpp>
  16. #include <boost/mpl/aux_/config/ctps.hpp>
  17. namespace boost { namespace mpl {
  18. template< typename T >
  19. struct is_na
  20. : false_
  21. {
  22. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  23. using false_::value;
  24. #endif
  25. };
  26. template<>
  27. struct is_na<na>
  28. : true_
  29. {
  30. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  31. using true_::value;
  32. #endif
  33. };
  34. template< typename T >
  35. struct is_not_na
  36. : true_
  37. {
  38. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  39. using true_::value;
  40. #endif
  41. };
  42. template<>
  43. struct is_not_na<na>
  44. : false_
  45. {
  46. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  47. using false_::value;
  48. #endif
  49. };
  50. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  51. template< typename T, typename U > struct if_na
  52. {
  53. typedef T type;
  54. };
  55. template< typename U > struct if_na<na,U>
  56. {
  57. typedef U type;
  58. };
  59. #else
  60. template< typename T > struct if_na_impl
  61. {
  62. template< typename U > struct apply
  63. {
  64. typedef T type;
  65. };
  66. };
  67. template<> struct if_na_impl<na>
  68. {
  69. template< typename U > struct apply
  70. {
  71. typedef U type;
  72. };
  73. };
  74. template< typename T, typename U > struct if_na
  75. : if_na_impl<T>::template apply<U>
  76. {
  77. };
  78. #endif
  79. }}
  80. #endif // BOOST_MPL_AUX_NA_HPP_INCLUDED