empty_base.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef BOOST_MPL_EMPTY_BASE_HPP_INCLUDED
  2. #define BOOST_MPL_EMPTY_BASE_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: empty_base.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
  11. // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
  12. // $Revision: 49267 $
  13. #include <boost/mpl/bool.hpp>
  14. #include <boost/mpl/aux_/config/msvc.hpp>
  15. #include <boost/mpl/aux_/config/workaround.hpp>
  16. #include <boost/type_traits/is_empty.hpp>
  17. // should be always the last #include directive
  18. #include <boost/type_traits/detail/bool_trait_def.hpp>
  19. namespace boost { namespace mpl {
  20. // empty base class, guaranteed to have no members; inheritance from
  21. // 'empty_base' through the 'inherit' metafunction is a no-op - see
  22. // "mpl/inherit.hpp> header for the details
  23. struct empty_base {};
  24. template< typename T >
  25. struct is_empty_base
  26. : false_
  27. {
  28. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  29. using false_::value;
  30. #endif
  31. };
  32. template<>
  33. struct is_empty_base<empty_base>
  34. : true_
  35. {
  36. #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
  37. using true_::value;
  38. #endif
  39. };
  40. }}
  41. namespace boost {
  42. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_empty, mpl::empty_base, true)
  43. }
  44. #include <boost/type_traits/detail/bool_trait_undef.hpp>
  45. #endif // BOOST_MPL_EMPTY_BASE_HPP_INCLUDED