is_abstract.hpp
Go to the documentation of this file.
1 #ifndef BOOST_TT_IS_ABSTRACT_CLASS_HPP
2 #define BOOST_TT_IS_ABSTRACT_CLASS_HPP
3 
4 #if defined(_MSC_VER)
5 # pragma once
6 #endif
7 
9 // is_abstract_class.hpp:
10 //
11 // (C) Copyright 2002 Rani Sharoni (rani_sharoni@hotmail.com) and Robert Ramey
12 // Use, modification and distribution is subject to the Boost Software
13 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
14 // http://www.boost.org/LICENSE_1_0.txt)
15 //
16 // See http://www.boost.org for updates, documentation, and revision history.
17 //
18 
19 // Compile type discovery whether given type is abstract class or not.
20 //
21 // Requires DR 337 to be supported by compiler
22 // (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#337).
23 //
24 //
25 // Believed (Jan 2004) to work on:
26 // - GCC 3.4
27 // - VC++ 7.1
28 // - compilers with new EDG frontend (Intel C++ 7, Comeau 4.3.2)
29 //
30 // Doesn't work on:
31 // - VC++6, VC++7.0 and less
32 // - GCC 3.3.X and less
33 // - Borland C++ 6 and less
34 //
35 //
36 // History:
37 // - Originally written by Rani Sharoni, see
38 // http://groups.google.com/groups?selm=df893da6.0207110613.75b2fe90%40posting.google.com
39 // At this time supported by EDG (Intel C++ 7, Comeau 4.3.2) and VC7.1.
40 // - Adapted and added into Boost.Serialization library by Robert Ramey
41 // (starting with submission #10).
42 // - Jan 2004: GCC 3.4 fixed to support DR337 (Giovanni Bajo).
43 // - Jan 2004: modified to be part of Boost.TypeTraits (Pavel Vozenilek).
44 // - Nov 2004: Christoph Ludwig found that the implementation did not work with
45 // template types and gcc-3.4 or VC7.1, fix due to Christoph Ludwig
46 // and John Maddock.
47 // - Dec 2004: Added new config macro BOOST_NO_IS_ABSTRACT which causes the template
48 // to degrade gracefully, rather than trash the compiler (John Maddock).
49 //
50 
51 #include <cstddef> // size_t
54 #ifndef BOOST_IS_ABSTRACT
55 #include <boost/static_assert.hpp>
58 #ifdef BOOST_NO_IS_ABSTRACT
60 #endif
61 #endif
62 
63 namespace boost {
64 
65 namespace detail{
66 
67 #ifdef BOOST_IS_ABSTRACT
68 template <class T>
69 struct is_abstract_imp
70 {
71  BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_ABSTRACT(T));
72 };
73 #elif !defined(BOOST_NO_IS_ABSTRACT)
74 template<class T>
76 {
77  // Deduction fails if T is void, function type,
78  // reference type (14.8.2/2)or an abstract class type
79  // according to review status issue #337
80  //
81  template<class U>
82  static type_traits::no_type check_sig(U (*)[1]);
83  template<class U>
84  static type_traits::yes_type check_sig(...);
85  //
86  // T must be a complete type, further if T is a template then
87  // it must be instantiated in order for us to get the right answer:
88  //
89  BOOST_STATIC_ASSERT(sizeof(T) != 0);
90 
91  // GCC2 won't even parse this template if we embed the computation
92  // of s1 in the computation of value.
93 #ifdef __GNUC__
94  BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0)));
95 #else
96 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
97 #pragma warning(push)
98 #pragma warning(disable:6334)
99 #endif
100  BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(check_sig<T>(0)));
101 #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
102 #pragma warning(pop)
103 #endif
104 #endif
105 
107  (s1 == sizeof(type_traits::yes_type)));
108 };
109 
110 template <bool v>
112 {
113  template <class T>
114  struct rebind
115  {
117  };
118 };
119 template <>
120 struct is_abstract_select<false>
121 {
122  template <class T>
123  struct rebind
124  {
125  typedef false_type type;
126  };
127 };
128 
129 template <class T>
131 {
133  typedef typename selector::template rebind<T> binder;
134  typedef typename binder::type type;
135 
137 };
138 
139 #endif
140 }
141 
142 #ifndef BOOST_NO_IS_ABSTRACT
143 template <class T> struct is_abstract : public integral_constant<bool, ::boost::detail::is_abstract_imp<T>::value> {};
144 #else
145 template <class T> struct is_abstract : public integral_constant<bool, ::boost::detail::is_polymorphic_imp<T>::value> {};
146 #endif
147 
148 } // namespace boost
149 
150 #endif //BOOST_TT_IS_ABSTRACT_CLASS_HPP
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
GLfloat value
is_abstract_select< ::boost::is_class< T >::value > selector
BOOST_STATIC_CONSTANT(bool, value=type::value)
const char * detail
#define BOOST_STATIC_ASSERT(...)
GLenum type
selector::template rebind< T > binder
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: glext.h:9721


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17