yes_no.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef BOOST_MPL_AUX_YES_NO_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_YES_NO_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_/nttp_decl.hpp>
  14. #include <boost/mpl/aux_/config/arrays.hpp>
  15. #include <boost/mpl/aux_/config/msvc.hpp>
  16. #include <boost/mpl/aux_/config/workaround.hpp>
  17. namespace boost { namespace mpl { namespace aux {
  18. typedef char (&no_tag)[1];
  19. typedef char (&yes_tag)[2];
  20. template< bool C_ > struct yes_no_tag
  21. {
  22. typedef no_tag type;
  23. };
  24. template<> struct yes_no_tag<true>
  25. {
  26. typedef yes_tag type;
  27. };
  28. template< BOOST_MPL_AUX_NTTP_DECL(long, n) > struct weighted_tag
  29. {
  30. #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  31. typedef char (&type)[n];
  32. #else
  33. char buf[n];
  34. typedef weighted_tag type;
  35. #endif
  36. };
  37. #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
  38. template<> struct weighted_tag<0>
  39. {
  40. typedef char (&type)[1];
  41. };
  42. #endif
  43. }}}
  44. #endif // BOOST_MPL_AUX_YES_NO_HPP_INCLUDED