empty_base.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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$
  11. // $Date$
  12. // $Revision$
  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/mpl/aux_/lambda_support.hpp>
  17. #include <boost/type_traits/integral_constant.hpp>
  18. #include <boost/type_traits/is_empty.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. template<> struct is_empty< mpl::empty_base >
  43. : public ::boost::integral_constant<bool,true>
  44. {
  45. public:
  46. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,is_empty,(mpl::empty_base))
  47. };
  48. }
  49. #endif // BOOST_MPL_EMPTY_BASE_HPP_INCLUDED