value_wknd.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-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/aux_/static_cast.hpp>
  14. #include <boost/mpl/aux_/config/integral.hpp>
  15. #include <boost/mpl/aux_/config/eti.hpp>
  16. #include <boost/mpl/aux_/config/workaround.hpp>
  17. #if defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS) \
  18. || defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
  19. # include <boost/mpl/int.hpp>
  20. namespace boost { namespace mpl { namespace aux {
  21. template< typename C_ > struct value_wknd
  22. : C_
  23. {
  24. };
  25. #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
  26. template<> struct value_wknd<int>
  27. : int_<1>
  28. {
  29. using int_<1>::value;
  30. };
  31. #endif
  32. }}}
  33. #if !defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
  34. # define BOOST_MPL_AUX_VALUE_WKND(C) \
  35. ::BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::aux::value_wknd< C > \
  36. /**/
  37. # define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) BOOST_MPL_AUX_VALUE_WKND(C)
  38. #else
  39. # define BOOST_MPL_AUX_VALUE_WKND(C) C
  40. # define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) \
  41. ::boost::mpl::aux::value_wknd< C > \
  42. /**/
  43. #endif
  44. #else // BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS
  45. # define BOOST_MPL_AUX_VALUE_WKND(C) C
  46. # define BOOST_MPL_AUX_MSVC_VALUE_WKND(C) C
  47. #endif
  48. #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
  49. # define BOOST_MPL_AUX_NESTED_VALUE_WKND(T, C) \
  50. BOOST_MPL_AUX_STATIC_CAST(T, C::value) \
  51. /**/
  52. #else
  53. # define BOOST_MPL_AUX_NESTED_VALUE_WKND(T, C) \
  54. BOOST_MPL_AUX_VALUE_WKND(C)::value \
  55. /**/
  56. #endif
  57. namespace boost { namespace mpl { namespace aux {
  58. template< typename T > struct value_type_wknd
  59. {
  60. typedef typename T::value_type type;
  61. };
  62. #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
  63. template<> struct value_type_wknd<int>
  64. {
  65. typedef int type;
  66. };
  67. #endif
  68. }}}
  69. #endif // BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED