yesno.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright Daniel Wallin, David Abrahams 2005.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef YESNO_050328_HPP
  6. #define YESNO_050328_HPP
  7. namespace boost { namespace parameter { namespace aux {
  8. // types used with the "sizeof trick" to capture the results of
  9. // overload resolution at compile-time.
  10. typedef char yes_tag;
  11. typedef char (&no_tag)[2];
  12. }}} // namespace boost::parameter::aux
  13. #include <boost/mpl/bool.hpp>
  14. namespace boost { namespace parameter { namespace aux {
  15. // mpl::true_ and mpl::false_ are not distinguishable by sizeof(),
  16. // so we pass them through these functions to get a type that is.
  17. ::boost::parameter::aux::yes_tag to_yesno(::boost::mpl::true_);
  18. ::boost::parameter::aux::no_tag to_yesno(::boost::mpl::false_);
  19. }}} // namespace boost::parameter::aux
  20. #include <boost/parameter/config.hpp>
  21. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  22. #include <boost/mp11/integral.hpp>
  23. namespace boost { namespace parameter { namespace aux {
  24. // mp11::mp_true and mp11::mp_false are not distinguishable by sizeof(),
  25. // so we pass them through these functions to get a type that is.
  26. ::boost::parameter::aux::yes_tag to_yesno(::boost::mp11::mp_true);
  27. ::boost::parameter::aux::no_tag to_yesno(::boost::mp11::mp_false);
  28. }}} // namespace boost::parameter::aux
  29. #endif // BOOST_PARAMETER_CAN_USE_MP11
  30. #endif // include guard