epoc32/include/stdapis/boost/serialization/is_abstract.hpp
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/serialization/is_abstract.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,137 @@
     1.4 +#ifndef BOOST_TT_IS_ABSTRACT_CLASS_HPP
     1.5 +#define BOOST_TT_IS_ABSTRACT_CLASS_HPP
     1.6 +
     1.7 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     1.8 +# pragma once
     1.9 +#endif
    1.10 +
    1.11 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
    1.12 +// is_abstract_class.hpp:
    1.13 +//
    1.14 +//  (C) Copyright 2002 Rani Sharoni (rani_sharoni@hotmail.com) and Robert Ramey
    1.15 +//  Use, modification and distribution is subject to the Boost Software
    1.16 +//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.17 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.18 +//  
    1.19 +//  See http://www.boost.org for updates, documentation, and revision history.
    1.20 +//
    1.21 +
    1.22 +// Compile type discovery whether given type is abstract class or not.
    1.23 +//
    1.24 +//   Requires DR 337 to be supported by compiler
    1.25 +//   (http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#337).
    1.26 +//
    1.27 +//
    1.28 +// Believed (Jan 2004) to work on:
    1.29 +//  - GCC 3.4
    1.30 +//  - VC++ 7.1
    1.31 +//  - compilers with new EDG frontend (Intel C++ 7, Comeau 4.3.2)
    1.32 +//
    1.33 +// Doesn't work on:
    1.34 +//  - VC++6, VC++7.0 and less
    1.35 +//  - GCC 3.3.X and less
    1.36 +//  - Borland C++ 6 and less
    1.37 +//      
    1.38 +//
    1.39 +// History:
    1.40 +//  - Originally written by Rani Sharoni, see
    1.41 +//    http://groups.google.com/groups?selm=df893da6.0207110613.75b2fe90%40posting.google.com
    1.42 +//    At this time supported by EDG (Intel C++ 7, Comeau 4.3.2) and VC7.1.
    1.43 +//  - Adapted and added into Boost.Serialization library by Robert Ramey 
    1.44 +//    (starting with submission #10).
    1.45 +//  - Jan 2004: GCC 3.4 fixed to suport DR337 (Giovanni Bajo).
    1.46 +//  - Jan 2004: modified to be part of Boost.TypeTraits (Pavel Vozenilek).
    1.47 +//  - Nov 2004: Christoph Ludwig found that the implementation did not work with
    1.48 +//              template types and gcc-3.4 or VC7.1, fix due to Christoph Ludwig
    1.49 +//              and John Maddock.
    1.50 +//  - Dec 2004: Added new config macro BOOST_NO_IS_ABSTRACT which causes the template
    1.51 +//              to degrade gracefully, rather than trash the compiler (John Maddock).
    1.52 +//
    1.53 +
    1.54 +#include <boost/static_assert.hpp>
    1.55 +#include <boost/type_traits/detail/yes_no_type.hpp>
    1.56 +#include <boost/type_traits/is_class.hpp>
    1.57 +#include <boost/type_traits/detail/ice_and.hpp>
    1.58 +#ifdef BOOST_NO_IS_ABSTRACT
    1.59 +#include <boost/type_traits/is_polymorphic.hpp>
    1.60 +#endif
    1.61 +// should be the last #include
    1.62 +#include <boost/type_traits/detail/bool_trait_def.hpp>
    1.63 +
    1.64 +
    1.65 +namespace boost {
    1.66 +namespace detail{
    1.67 +
    1.68 +#ifndef BOOST_NO_IS_ABSTRACT
    1.69 +template<class T>
    1.70 +struct is_abstract_imp2
    1.71 +{
    1.72 +   // Deduction fails if T is void, function type, 
    1.73 +   // reference type (14.8.2/2)or an abstract class type 
    1.74 +   // according to review status issue #337
    1.75 +   //
    1.76 +   template<class U>
    1.77 +   static type_traits::no_type check_sig(U (*)[1]);
    1.78 +   template<class U>
    1.79 +   static type_traits::yes_type check_sig(...);
    1.80 +   //
    1.81 +   // T must be a complete type, further if T is a template then
    1.82 +   // it must be instantiated in order for us to get the right answer:
    1.83 +   //
    1.84 +   BOOST_STATIC_ASSERT(sizeof(T) != 0);
    1.85 +
    1.86 +   // GCC2 won't even parse this template if we embed the computation
    1.87 +   // of s1 in the computation of value.
    1.88 +#ifdef __GNUC__
    1.89 +   BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0)));
    1.90 +#else
    1.91 +   BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0)));
    1.92 +#endif
    1.93 +    
    1.94 +   BOOST_STATIC_CONSTANT(bool, value = 
    1.95 +      (s1 == sizeof(type_traits::yes_type)));
    1.96 +};
    1.97 +
    1.98 +template <bool v>
    1.99 +struct is_abstract_select
   1.100 +{
   1.101 +   template <class T>
   1.102 +   struct rebind
   1.103 +   {
   1.104 +      typedef is_abstract_imp2<T> type;
   1.105 +   };
   1.106 +};
   1.107 +template <>
   1.108 +struct is_abstract_select<false>
   1.109 +{
   1.110 +   template <class T>
   1.111 +   struct rebind
   1.112 +   {
   1.113 +      typedef false_type type;
   1.114 +   };
   1.115 +};
   1.116 +
   1.117 +template <class T>
   1.118 +struct is_abstract_imp
   1.119 +{
   1.120 +   typedef is_abstract_select< ::boost::is_class<T>::value> selector;
   1.121 +   typedef typename selector::template rebind<T> binder;
   1.122 +   typedef typename binder::type type;
   1.123 +
   1.124 +   BOOST_STATIC_CONSTANT(bool, value = type::value);
   1.125 +};
   1.126 +
   1.127 +#endif
   1.128 +}
   1.129 +
   1.130 +#ifndef BOOST_NO_IS_ABSTRACT
   1.131 +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_abstract_imp<T>::value)
   1.132 +#else
   1.133 +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_polymorphic_imp<T>::value)
   1.134 +#endif
   1.135 +
   1.136 +} // namespace boost
   1.137 +
   1.138 +#include <boost/type_traits/detail/bool_trait_undef.hpp>
   1.139 +
   1.140 +#endif //BOOST_TT_IS_ABSTRACT_CLASS_HPP