BVB Source Codes

mars Show is_class.hpp Source code

Return Download mars: download is_class.hpp Source code - Download mars Source code - Type:.hpp
  1. //  (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
  2. //  Hinnant & John Maddock 2000-2003.
  3. //  Use, modification and distribution are subject to the Boost Software License,
  4. //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. //  http://www.boost.org/LICENSE_1_0.txt).
  6. //
  7. //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
  8.  
  9.  
  10. #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED
  11. #define BOOST_TT_IS_CLASS_HPP_INCLUDED
  12.  
  13. #include <boost/type_traits/detail/config.hpp>
  14. #include <boost/type_traits/intrinsics.hpp>
  15. #include <boost/type_traits/integral_constant.hpp>
  16. #ifndef BOOST_IS_CLASS
  17. #   include <boost/type_traits/is_union.hpp>
  18.  
  19. #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
  20. #   include <boost/type_traits/detail/yes_no_type.hpp>
  21. #else
  22. #   include <boost/type_traits/is_scalar.hpp>
  23. #   include <boost/type_traits/is_array.hpp>
  24. #   include <boost/type_traits/is_reference.hpp>
  25. #   include <boost/type_traits/is_void.hpp>
  26. #   include <boost/type_traits/is_function.hpp>
  27. #endif
  28.  
  29. #endif // BOOST_IS_CLASS
  30.  
  31. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  32.  
  33. namespace detail {
  34.  
  35. #ifndef BOOST_IS_CLASS
  36. #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
  37.  
  38. // This is actually the conforming implementation which works with
  39. // abstract classes.  However, enough compilers have trouble with
  40. // it that most will use the one in
  41. // boost/type_traits/object_traits.hpp. This implementation
  42. // actually works with VC7.0, but other interactions seem to fail
  43. // when we use it.
  44.  
  45. // is_class<> metafunction due to Paul Mensonides
  46. // (leavings@attbi.com). For more details:
  47. // http://groups.google.com/groups?hl=en&selm=000001c1cc83%24e154d5e0%247772e50c%40c161550a&rnum=1
  48. #if defined(__GNUC__)  && !defined(__EDG_VERSION__)
  49.  
  50. template <class U> ::mars_boost::type_traits::yes_type is_class_tester(void(U::*)(void));
  51. template <class U> ::mars_boost::type_traits::no_type is_class_tester(...);
  52.  
  53. template <typename T>
  54. struct is_class_impl
  55. {
  56.  
  57.     BOOST_STATIC_CONSTANT(bool, value =
  58.             sizeof(is_class_tester<T>(0)) == sizeof(::mars_boost::type_traits::yes_type)
  59.             && ! ::mars_boost::is_union<T>::value
  60.         );
  61. };
  62.  
  63. #else
  64.  
  65. template <typename T>
  66. struct is_class_impl
  67. {
  68.     template <class U> static ::mars_boost::type_traits::yes_type is_class_tester(void(U::*)(void));
  69.     template <class U> static ::mars_boost::type_traits::no_type is_class_tester(...);
  70.  
  71.     BOOST_STATIC_CONSTANT(bool, value =
  72.             sizeof(is_class_tester<T>(0)) == sizeof(::mars_boost::type_traits::yes_type)
  73.             && ! ::mars_boost::is_union<T>::value
  74.         );
  75. };
  76.  
  77. #endif
  78.  
  79. #else
  80.  
  81. template <typename T>
  82. struct is_class_impl
  83. {
  84.     BOOST_STATIC_CONSTANT(bool, value =
  85.         ! ::mars_boost::is_union<T>::value >::value
  86.         && ! ::mars_boost::is_scalar<T>::value
  87.         && ! ::mars_boost::is_array<T>::value
  88.         && ! ::mars_boost::is_reference<T>::value
  89.         && ! ::mars_boost::is_void<T>::value
  90.         && ! ::mars_boost::is_function<T>::value
  91.         );
  92. };
  93.  
  94. # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
  95. # else // BOOST_IS_CLASS
  96. template <typename T>
  97. struct is_class_impl
  98. {
  99.     BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_CLASS(T));
  100. };
  101. # endif // BOOST_IS_CLASS
  102.  
  103. } // namespace detail
  104.  
  105. template <class T> struct is_class : public integral_constant<bool, ::mars_boost::detail::is_class_impl<T>::value> {};
  106. # ifdef __EDG_VERSION__
  107. template <class T> struct is_class<const T> : public is_class<T>{};
  108. template <class T> struct is_class<const volatile T> : public is_class<T>{};
  109. template <class T> struct is_class<volatile T> : public is_class<T>{};
  110. # endif
  111.    
  112. } // namespace mars_boost
  113.  
  114. #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED
  115.  
downloadis_class.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top