Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:40

0001 #ifndef BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED
0002 #define BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED
0003 
0004 // Copyright 2020 Peter Dimov
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // https://www.boost.org/LICENSE_1_0.txt
0007 
0008 #include <boost/describe/detail/compute_base_modifiers.hpp>
0009 #include <boost/describe/detail/pp_for_each.hpp>
0010 #include <boost/describe/detail/list.hpp>
0011 #include <type_traits>
0012 
0013 namespace boost
0014 {
0015 namespace describe
0016 {
0017 namespace detail
0018 {
0019 
0020 // base_descriptor
0021 template<class C, class B> struct base_descriptor
0022 {
0023     static_assert( std::is_base_of<B, C>::value, "A type listed as a base is not one" );
0024 
0025     using type = B;
0026     static constexpr unsigned modifiers = compute_base_modifiers<C, B>();
0027 };
0028 
0029 #ifndef __cpp_inline_variables
0030 template<class C, class B> constexpr unsigned base_descriptor<C, B>::modifiers;
0031 #endif
0032 
0033 template<class... T> auto base_descriptor_fn_impl( int, T... )
0034 {
0035     return list<T...>();
0036 }
0037 
0038 #define BOOST_DESCRIBE_BASE_IMPL(C, B) , boost::describe::detail::base_descriptor<C, B>()
0039 
0040 #if defined(_MSC_VER) && !defined(__clang__)
0041 
0042 #define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
0043 { return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, __VA_ARGS__) ); }
0044 
0045 #else
0046 
0047 #define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
0048 { return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, ##__VA_ARGS__) ); }
0049 
0050 #endif
0051 
0052 } // namespace detail
0053 } // namespace describe
0054 } // namespace boost
0055 
0056 #endif // #ifndef BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED