void.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef BOOST_MPL_VOID_HPP_INCLUDED
  2. #define BOOST_MPL_VOID_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/void_fwd.hpp>
  14. #include <boost/mpl/bool.hpp>
  15. #include <boost/mpl/aux_/na_spec.hpp>
  16. #include <boost/mpl/aux_/config/msvc.hpp>
  17. #include <boost/mpl/aux_/config/workaround.hpp>
  18. BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
  19. // [JDG Feb-4-2003] made void_ a complete type to allow it to be
  20. // instantiated so that it can be passed in as an object that can be
  21. // used to select an overloaded function. Possible use includes signaling
  22. // a zero arity functor evaluation call.
  23. struct void_ { typedef void_ type; };
  24. BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
  25. namespace boost { namespace mpl {
  26. template< typename T >
  27. struct is_void_
  28. : false_
  29. {
  30. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  31. using false_::value;
  32. #endif
  33. };
  34. template<>
  35. struct is_void_<void_>
  36. : true_
  37. {
  38. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  39. using true_::value;
  40. #endif
  41. };
  42. template< typename T >
  43. struct is_not_void_
  44. : true_
  45. {
  46. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  47. using true_::value;
  48. #endif
  49. };
  50. template<>
  51. struct is_not_void_<void_>
  52. : false_
  53. {
  54. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  55. using false_::value;
  56. #endif
  57. };
  58. BOOST_MPL_AUX_NA_SPEC(1, is_void_)
  59. BOOST_MPL_AUX_NA_SPEC(1, is_not_void_)
  60. }}
  61. #endif // BOOST_MPL_VOID_HPP_INCLUDED