| 1 | |
|---|---|
| 2 | #ifndef BOOST_MPL_EMPTY_BASE_HPP_INCLUDED |
| 3 | #define BOOST_MPL_EMPTY_BASE_HPP_INCLUDED |
| 4 | |
| 5 | // Copyright Aleksey Gurtovoy 2001-2004 |
| 6 | // |
| 7 | // Distributed under the Boost Software License, Version 1.0. |
| 8 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 9 | // http://www.boost.org/LICENSE_1_0.txt) |
| 10 | // |
| 11 | // See http://www.boost.org/libs/mpl for documentation. |
| 12 | |
| 13 | // $Id$ |
| 14 | // $Date$ |
| 15 | // $Revision$ |
| 16 | |
| 17 | #include <boost/mpl/bool.hpp> |
| 18 | #include <boost/mpl/aux_/config/msvc.hpp> |
| 19 | #include <boost/mpl/aux_/config/workaround.hpp> |
| 20 | #include <boost/mpl/aux_/lambda_support.hpp> |
| 21 | |
| 22 | #include <boost/type_traits/integral_constant.hpp> |
| 23 | #include <boost/type_traits/is_empty.hpp> |
| 24 | |
| 25 | namespace boost { namespace mpl { |
| 26 | |
| 27 | // empty base class, guaranteed to have no members; inheritance from |
| 28 | // 'empty_base' through the 'inherit' metafunction is a no-op - see |
| 29 | // "mpl/inherit.hpp> header for the details |
| 30 | struct empty_base {}; |
| 31 | |
| 32 | template< typename T > |
| 33 | struct is_empty_base |
| 34 | : false_ |
| 35 | { |
| 36 | #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) |
| 37 | using false_::value; |
| 38 | #endif |
| 39 | }; |
| 40 | |
| 41 | template<> |
| 42 | struct is_empty_base<empty_base> |
| 43 | : true_ |
| 44 | { |
| 45 | #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) |
| 46 | using true_::value; |
| 47 | #endif |
| 48 | }; |
| 49 | |
| 50 | }} |
| 51 | |
| 52 | namespace boost { |
| 53 | |
| 54 | template<> struct is_empty< mpl::empty_base > |
| 55 | : public ::boost::integral_constant<bool,true> |
| 56 | { |
| 57 | public: |
| 58 | BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,is_empty,(mpl::empty_base)) |
| 59 | }; |
| 60 | |
| 61 | } |
| 62 | |
| 63 | #endif // BOOST_MPL_EMPTY_BASE_HPP_INCLUDED |
| 64 |
