1#ifndef BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED
2#define BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED
3
4// Copyright 2020 Peter Dimov
5// Distributed under the Boost Software License, Version 1.0.
6// https://www.boost.org/LICENSE_1_0.txt
7
8#include <boost/describe/detail/compute_base_modifiers.hpp>
9#include <boost/describe/detail/pp_for_each.hpp>
10#include <boost/describe/detail/list.hpp>
11#include <type_traits>
12
13namespace boost
14{
15namespace describe
16{
17namespace detail
18{
19
20// base_descriptor
21template<class C, class B> struct base_descriptor
22{
23 static_assert( std::is_base_of<B, C>::value, "A type listed as a base is not one" );
24
25 using type = B;
26 static constexpr unsigned modifiers = compute_base_modifiers<C, B>();
27};
28
29#ifndef __cpp_inline_variables
30template<class C, class B> constexpr unsigned base_descriptor<C, B>::modifiers;
31#endif
32
33template<class... T> auto base_descriptor_fn_impl( int, T... )
34{
35 return list<T...>();
36}
37
38#define BOOST_DESCRIBE_BASE_IMPL(C, B) , boost::describe::detail::base_descriptor<C, B>()
39
40#if defined(_MSC_VER) && !defined(__clang__)
41
42#define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
43{ return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, __VA_ARGS__) ); }
44
45#else
46
47#define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
48{ return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, ##__VA_ARGS__) ); }
49
50#endif
51
52} // namespace detail
53} // namespace describe
54} // namespace boost
55
56#endif // #ifndef BOOST_DESCRIBE_DETAIL_BASES_HPP_INCLUDED
57

source code of boost/libs/describe/include/boost/describe/detail/bases.hpp