BVB Source Codes

mars Show typeinfo.hpp Source code

Return Download mars: download typeinfo.hpp Source code - Download mars Source code - Type:.hpp
  1. #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
  2. #define BOOST_CORE_TYPEINFO_HPP_INCLUDED
  3.  
  4. // MS compatible compilers support #pragma once
  5.  
  6. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  7. # pragma once
  8. #endif
  9.  
  10. //  core::typeinfo, BOOST_CORE_TYPEID
  11. //
  12. //  Copyright 2007, 2014 Peter Dimov
  13. //
  14. //  Distributed under the Boost Software License, Version 1.0.
  15. //  See accompanying file LICENSE_1_0.txt or copy at
  16. //  http://www.boost.org/LICENSE_1_0.txt)
  17.  
  18. #include <boost/config.hpp>
  19.  
  20. #if defined( BOOST_NO_TYPEID )
  21.  
  22. #include <boost/current_function.hpp>
  23. #include <functional>
  24.  
  25. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
  26. {
  27.  
  28. namespace core
  29. {
  30.  
  31. class typeinfo
  32. {
  33. private:
  34.  
  35.     typeinfo( typeinfo const& );
  36.     typeinfo& operator=( typeinfo const& );
  37.  
  38.     char const * name_;
  39.  
  40. public:
  41.  
  42.     explicit typeinfo( char const * name ): name_( name )
  43.     {
  44.     }
  45.  
  46.     bool operator==( typeinfo const& rhs ) const
  47.     {
  48.         return this == &rhs;
  49.     }
  50.  
  51.     bool operator!=( typeinfo const& rhs ) const
  52.     {
  53.         return this != &rhs;
  54.     }
  55.  
  56.     bool before( typeinfo const& rhs ) const
  57.     {
  58.         return std::less< typeinfo const* >()( this, &rhs );
  59.     }
  60.  
  61.     char const* name() const
  62.     {
  63.         return name_;
  64.     }
  65. };
  66.  
  67. inline char const * demangled_name( core::typeinfo const & ti )
  68. {
  69.     return ti.name();
  70. }
  71.  
  72. } // namespace core
  73.  
  74. namespace detail
  75. {
  76.  
  77. template<class T> struct core_typeid_
  78. {
  79.     static mars_boost::core::typeinfo ti_;
  80.  
  81.     static char const * name()
  82.     {
  83.         return BOOST_CURRENT_FUNCTION;
  84.     }
  85. };
  86.  
  87. #if defined(__SUNPRO_CC)
  88. // see #4199, the Sun Studio compiler gets confused about static initialization
  89. // constructor arguments. But an assignment works just fine.
  90. template<class T> mars_boost::core::typeinfo core_typeid_< T >::ti_ = core_typeid_< T >::name();
  91. #else
  92. template<class T> mars_boost::core::typeinfo core_typeid_< T >::ti_(core_typeid_< T >::name());
  93. #endif
  94.  
  95. template<class T> struct core_typeid_< T & >: core_typeid_< T >
  96. {
  97. };
  98.  
  99. template<class T> struct core_typeid_< T const >: core_typeid_< T >
  100. {
  101. };
  102.  
  103. template<class T> struct core_typeid_< T volatile >: core_typeid_< T >
  104. {
  105. };
  106.  
  107. template<class T> struct core_typeid_< T const volatile >: core_typeid_< T >
  108. {
  109. };
  110.  
  111. } // namespace detail
  112.  
  113. } // namespace mars_boost
  114.  
  115. #define BOOST_CORE_TYPEID(T) (mars_boost::detail::core_typeid_<T>::ti_)
  116.  
  117. #else
  118.  
  119. #include <boost/core/demangle.hpp>
  120. #include <typeinfo>
  121.  
  122. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
  123. {
  124.  
  125. namespace core
  126. {
  127.  
  128. #if defined( BOOST_NO_STD_TYPEINFO )
  129.  
  130. typedef ::type_info typeinfo;
  131.  
  132. #else
  133.  
  134. typedef std::type_info typeinfo;
  135.  
  136. #endif
  137.  
  138. inline std::string demangled_name( core::typeinfo const & ti )
  139. {
  140.     return core::demangle( ti.name() );
  141. }
  142.  
  143. } // namespace core
  144.  
  145. } // namespace mars_boost
  146.  
  147. #define BOOST_CORE_TYPEID(T) typeid(T)
  148.  
  149. #endif
  150.  
  151. #endif  // #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
  152.  
downloadtypeinfo.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