Blame view

3rdparty/boost_1_81_0/boost/concept/detail/general.hpp 2.59 KB
63e88f80   Hu Chunming   提交三方库
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  // Copyright David Abrahams 2006. Distributed under the Boost
  // Software License, Version 1.0. (See accompanying
  // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  #ifndef BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
  # define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
  
  # include <boost/config.hpp>
  # include <boost/preprocessor/cat.hpp>
  # include <boost/concept/detail/backward_compatibility.hpp>
  
  # ifdef BOOST_OLD_CONCEPT_SUPPORT
  #  include <boost/concept/detail/has_constraints.hpp>
  #  include <boost/type_traits/conditional.hpp>
  # endif
  
  // This implementation works on Comeau and GCC, all the way back to
  // 2.95
  namespace boost { namespace concepts {
  
  template <class ModelFn>
  struct requirement_;
  
  namespace detail
  {
    template <void(*)()> struct instantiate {};
  }
  
  template <class Model>
  struct requirement
  {
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic push
  #   pragma GCC diagnostic ignored "-Wnonnull"
  #   endif
      static void failed() { ((Model*)0)->~Model(); }
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic pop
  #   endif
  };
  
  struct failed {};
  
  template <class Model>
  struct requirement<failed ************ Model::************>
  {
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic push
  #   pragma GCC diagnostic ignored "-Wnonnull"
  #   endif
      static void failed() { ((Model*)0)->~Model(); }
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic pop
  #   endif
  };
  
  # ifdef BOOST_OLD_CONCEPT_SUPPORT
  
  template <class Model>
  struct constraint
  {
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic push
  #   pragma GCC diagnostic ignored "-Wnonnull"
  #   endif
      static void failed() { ((Model*)0)->constraints(); }
  #   if defined(BOOST_GCC) && (BOOST_GCC >= 110000)
  #   pragma GCC diagnostic pop
  #   endif
  };
    
  template <class Model>
  struct requirement_<void(*)(Model)>
    : boost::conditional<
          concepts::not_satisfied<Model>::value
        , constraint<Model>
        , requirement<failed ************ Model::************>
      >::type
  {};
    
  # else
  
  // For GCC-2.x, these can't have exactly the same name
  template <class Model>
  struct requirement_<void(*)(Model)>
      : requirement<failed ************ Model::************>
  {};
    
  # endif
  
  #  define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr )             \
      typedef ::boost::concepts::detail::instantiate<          \
      &::boost::concepts::requirement_<ModelFnPtr>::failed>    \
        BOOST_PP_CAT(boost_concept_check,__LINE__)             \
        BOOST_ATTRIBUTE_UNUSED
  
  }}
  
  #endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP