Blame view

3rdparty/boost_1_81_0/boost/describe/class.hpp 3.06 KB
598bfd3f   Hu Chunming   提交_GLIBCXX_USE_CX...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  #ifndef BOOST_DESCRIBE_CLASS_HPP_INCLUDED
  #define BOOST_DESCRIBE_CLASS_HPP_INCLUDED
  
  // Copyright 2020 Peter Dimov
  // Distributed under the Boost Software License, Version 1.0.
  // https://www.boost.org/LICENSE_1_0.txt
  
  #include <boost/describe/detail/config.hpp>
  
  #if !defined(BOOST_DESCRIBE_CXX14)
  
  #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private)
  #define BOOST_DESCRIBE_STRUCT(C, Bases, Members)
  
  #else
  
  #include <boost/describe/detail/bases.hpp>
  #include <boost/describe/detail/members.hpp>
  #include <type_traits>
  
  namespace boost
  {
  namespace describe
  {
  
  #if defined(_MSC_VER) && !defined(__clang__)
  
  #define BOOST_DESCRIBE_PP_UNPACK(...) __VA_ARGS__
  
  #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private) \
      friend BOOST_DESCRIBE_BASES(C, BOOST_DESCRIBE_PP_UNPACK Bases) \
      friend BOOST_DESCRIBE_PUBLIC_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Public) \
      friend BOOST_DESCRIBE_PROTECTED_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Protected) \
      friend BOOST_DESCRIBE_PRIVATE_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Private)
  
  #define BOOST_DESCRIBE_STRUCT(C, Bases, Members) \
      static_assert(std::is_class<C>::value || std::is_union<C>::value, "BOOST_DESCRIBE_STRUCT should only be used with class types"); \
      BOOST_DESCRIBE_BASES(C, BOOST_DESCRIBE_PP_UNPACK Bases) \
      BOOST_DESCRIBE_PUBLIC_MEMBERS(C, BOOST_DESCRIBE_PP_UNPACK Members) \
      BOOST_DESCRIBE_PROTECTED_MEMBERS(C) \
      BOOST_DESCRIBE_PRIVATE_MEMBERS(C)
  
  #else
  
  #if defined(__GNUC__) && __GNUC__ >= 8
  # define BOOST_DESCRIBE_PP_UNPACK(...) __VA_OPT__(,) __VA_ARGS__
  #else
  # define BOOST_DESCRIBE_PP_UNPACK(...) , ##__VA_ARGS__
  #endif
  
  #define BOOST_DESCRIBE_BASES_(...) BOOST_DESCRIBE_BASES(__VA_ARGS__)
  #define BOOST_DESCRIBE_PUBLIC_MEMBERS_(...) BOOST_DESCRIBE_PUBLIC_MEMBERS(__VA_ARGS__)
  #define BOOST_DESCRIBE_PROTECTED_MEMBERS_(...) BOOST_DESCRIBE_PROTECTED_MEMBERS(__VA_ARGS__)
  #define BOOST_DESCRIBE_PRIVATE_MEMBERS_(...) BOOST_DESCRIBE_PRIVATE_MEMBERS(__VA_ARGS__)
  
  #define BOOST_DESCRIBE_CLASS(C, Bases, Public, Protected, Private) \
      BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_BASES_(C BOOST_DESCRIBE_PP_UNPACK Bases) \
      BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PUBLIC_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Public) \
      BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PROTECTED_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Protected) \
      BOOST_DESCRIBE_MAYBE_UNUSED friend BOOST_DESCRIBE_PRIVATE_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Private)
  
  #define BOOST_DESCRIBE_STRUCT(C, Bases, Members) \
      static_assert(std::is_class<C>::value || std::is_union<C>::value, "BOOST_DESCRIBE_STRUCT should only be used with class types"); \
      BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_BASES_(C BOOST_DESCRIBE_PP_UNPACK Bases) \
      BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PUBLIC_MEMBERS_(C BOOST_DESCRIBE_PP_UNPACK Members) \
      BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PROTECTED_MEMBERS_(C) \
      BOOST_DESCRIBE_MAYBE_UNUSED BOOST_DESCRIBE_PRIVATE_MEMBERS_(C)
  
  #endif
  
  } // namespace describe
  } // namespace boost
  
  #endif // !defined(BOOST_DESCRIBE_CXX14)
  
  #endif // #ifndef BOOST_DESCRIBE_CLASS_HPP_INCLUDED