epoc32/include/stdapis/boost/iterator/detail/enable_if.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/iterator/detail/enable_if.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/iterator/detail/enable_if.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,119 +1,86 @@
     1.4 -// Boost enable_if library
     1.5 +// (C) Copyright David Abrahams 2002.
     1.6 +// (C) Copyright Jeremy Siek    2002.
     1.7 +// (C) Copyright Thomas Witt    2002.
     1.8 +// Distributed under the Boost Software License, Version 1.0. (See
     1.9 +// accompanying file LICENSE_1_0.txt or copy at
    1.10 +// http://www.boost.org/LICENSE_1_0.txt)
    1.11 +#ifndef BOOST_ENABLE_IF_23022003THW_HPP
    1.12 +#define BOOST_ENABLE_IF_23022003THW_HPP
    1.13  
    1.14 -// Copyright 2003 © The Trustees of Indiana University.
    1.15 +#include <boost/detail/workaround.hpp>
    1.16 +#include <boost/mpl/identity.hpp>
    1.17  
    1.18 -// Use, modification, and distribution is subject to the Boost Software
    1.19 -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.20 -// http://www.boost.org/LICENSE_1_0.txt)
    1.21 +#include <boost/iterator/detail/config_def.hpp>
    1.22  
    1.23 -//    Authors: Jaakko Järvi (jajarvi at osl.iu.edu)
    1.24 -//             Jeremiah Willcock (jewillco at osl.iu.edu)
    1.25 -//             Andrew Lumsdaine (lums at osl.iu.edu)
    1.26 -
    1.27 -
    1.28 -#ifndef BOOST_UTILITY_ENABLE_IF_HPP
    1.29 -#define BOOST_UTILITY_ENABLE_IF_HPP
    1.30 -
    1.31 -#include "boost/config.hpp"
    1.32 -
    1.33 -// Even the definition of enable_if causes problems on some compilers,
    1.34 -// so it's macroed out for all compilers that do not support SFINAE
    1.35 -
    1.36 -#ifndef BOOST_NO_SFINAE
    1.37 +//
    1.38 +// Boost iterators uses its own enable_if cause we need
    1.39 +// special semantics for deficient compilers.
    1.40 +// 23/02/03 thw
    1.41 +//
    1.42  
    1.43  namespace boost
    1.44  {
    1.45 - 
    1.46 -  template <bool B, class T = void>
    1.47 -  struct enable_if_c {
    1.48 -    typedef T type;
    1.49 -  };
    1.50  
    1.51 -  template <class T>
    1.52 -  struct enable_if_c<false, T> {};
    1.53 +  namespace iterators
    1.54 +  {
    1.55 +    //
    1.56 +    // Base machinery for all kinds of enable if
    1.57 +    //
    1.58 +    template<bool>
    1.59 +    struct enabled
    1.60 +    {
    1.61 +      template<typename T>
    1.62 +      struct base
    1.63 +      {
    1.64 +        typedef T type;
    1.65 +      };
    1.66 +    };
    1.67 +    
    1.68 +    //
    1.69 +    // For compilers that don't support "Substitution Failure Is Not An Error"
    1.70 +    // enable_if falls back to always enabled. See comments
    1.71 +    // on operator implementation for consequences.
    1.72 +    //
    1.73 +    template<>
    1.74 +    struct enabled<false>
    1.75 +    {
    1.76 +      template<typename T>
    1.77 +      struct base
    1.78 +      {
    1.79 +#ifdef BOOST_NO_SFINAE
    1.80  
    1.81 -  template <class Cond, class T = void> 
    1.82 -  struct enable_if : public enable_if_c<Cond::value, T> {};
    1.83 +        typedef T type;
    1.84  
    1.85 -  template <bool B, class T>
    1.86 -  struct lazy_enable_if_c {
    1.87 -    typedef typename T::type type;
    1.88 -  };
    1.89 +        // This way to do it would give a nice error message containing
    1.90 +        // invalid overload, but has the big disadvantage that
    1.91 +        // there is no reference to user code in the error message.
    1.92 +        //
    1.93 +        // struct invalid_overload;
    1.94 +        // typedef invalid_overload type;
    1.95 +        //
    1.96 +#endif
    1.97 +      };
    1.98 +    };
    1.99  
   1.100 -  template <class T>
   1.101 -  struct lazy_enable_if_c<false, T> {};
   1.102  
   1.103 -  template <class Cond, class T> 
   1.104 -  struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
   1.105 +    template <class Cond,
   1.106 +              class Return>
   1.107 +    struct enable_if
   1.108 +# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
   1.109 +      : enabled<(Cond::value)>::template base<Return>
   1.110 +# else
   1.111 +      : mpl::identity<Return>
   1.112 +# endif 
   1.113 +    {
   1.114 +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
   1.115 +        typedef Return type;
   1.116 +# endif 
   1.117 +    };
   1.118  
   1.119 -
   1.120 -  template <bool B, class T = void>
   1.121 -  struct disable_if_c {
   1.122 -    typedef T type;
   1.123 -  };
   1.124 -
   1.125 -  template <class T>
   1.126 -  struct disable_if_c<true, T> {};
   1.127 -
   1.128 -  template <class Cond, class T = void> 
   1.129 -  struct disable_if : public disable_if_c<Cond::value, T> {};
   1.130 -
   1.131 -  template <bool B, class T>
   1.132 -  struct lazy_disable_if_c {
   1.133 -    typedef typename T::type type;
   1.134 -  };
   1.135 -
   1.136 -  template <class T>
   1.137 -  struct lazy_disable_if_c<true, T> {};
   1.138 -
   1.139 -  template <class Cond, class T> 
   1.140 -  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   1.141 +  } // namespace iterators
   1.142  
   1.143  } // namespace boost
   1.144  
   1.145 -#else
   1.146 +#include <boost/iterator/detail/config_undef.hpp>
   1.147  
   1.148 -namespace boost {
   1.149 -
   1.150 -  namespace detail { typedef void enable_if_default_T; }
   1.151 -
   1.152 -  template <typename T>
   1.153 -  struct enable_if_does_not_work_on_this_compiler;
   1.154 -
   1.155 -  template <bool B, class T = detail::enable_if_default_T>
   1.156 -  struct enable_if_c : enable_if_does_not_work_on_this_compiler<T>
   1.157 -  { };
   1.158 -
   1.159 -  template <bool B, class T = detail::enable_if_default_T> 
   1.160 -  struct disable_if_c : enable_if_does_not_work_on_this_compiler<T>
   1.161 -  { };
   1.162 -
   1.163 -  template <bool B, class T = detail::enable_if_default_T> 
   1.164 -  struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler<T>
   1.165 -  { };
   1.166 -
   1.167 -  template <bool B, class T = detail::enable_if_default_T> 
   1.168 -  struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler<T>
   1.169 -  { };
   1.170 -
   1.171 -  template <class Cond, class T = detail::enable_if_default_T> 
   1.172 -  struct enable_if : enable_if_does_not_work_on_this_compiler<T>
   1.173 -  { };
   1.174 -
   1.175 -  template <class Cond, class T = detail::enable_if_default_T> 
   1.176 -  struct disable_if : enable_if_does_not_work_on_this_compiler<T>
   1.177 -  { };
   1.178 -
   1.179 -  template <class Cond, class T = detail::enable_if_default_T> 
   1.180 -  struct lazy_enable_if : enable_if_does_not_work_on_this_compiler<T>
   1.181 -  { };
   1.182 -
   1.183 -  template <class Cond, class T = detail::enable_if_default_T> 
   1.184 -  struct lazy_disable_if : enable_if_does_not_work_on_this_compiler<T>
   1.185 -  { };
   1.186 -
   1.187 -} // namespace boost
   1.188 -
   1.189 -#endif // BOOST_NO_SFINAE
   1.190 -
   1.191 -#endif
   1.192 +#endif // BOOST_ENABLE_IF_23022003THW_HPP