integral_c.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef BOOST_MPL_INTEGRAL_C_HPP_INCLUDED
  2. #define BOOST_MPL_INTEGRAL_C_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2006
  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/integral_c_fwd.hpp>
  14. #include <boost/mpl/aux_/config/ctps.hpp>
  15. #include <boost/mpl/aux_/config/static_constant.hpp>
  16. #include <boost/mpl/aux_/config/workaround.hpp>
  17. #if BOOST_WORKAROUND(__HP_aCC, <= 53800)
  18. // the type of non-type template arguments may not depend on template arguments
  19. # define AUX_WRAPPER_PARAMS(N) typename T, long N
  20. #else
  21. # define AUX_WRAPPER_PARAMS(N) typename T, T N
  22. #endif
  23. #define AUX_WRAPPER_NAME integral_c
  24. #define AUX_WRAPPER_VALUE_TYPE T
  25. #define AUX_WRAPPER_INST(value) AUX_WRAPPER_NAME< T, value >
  26. #include <boost/mpl/aux_/integral_wrapper.hpp>
  27. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
  28. && !BOOST_WORKAROUND(__BORLANDC__, <= 0x551)
  29. BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
  30. // 'bool' constant doesn't have 'next'/'prior' members
  31. template< bool C >
  32. struct integral_c<bool, C>
  33. {
  34. BOOST_STATIC_CONSTANT(bool, value = C);
  35. typedef integral_c_tag tag;
  36. typedef integral_c type;
  37. typedef bool value_type;
  38. operator bool() const { return this->value; }
  39. };
  40. BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
  41. #endif
  42. #endif // BOOST_MPL_INTEGRAL_C_HPP_INCLUDED