epoc32/include/stdapis/boost/iterator/detail/enable_if.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/stdapis/boost/utility/enable_if.hpp@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Boost enable_if library
williamr@2
     2
williamr@2
     3
// Copyright 2003 © The Trustees of Indiana University.
williamr@2
     4
williamr@2
     5
// Use, modification, and distribution is subject to the Boost Software
williamr@2
     6
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
williamr@2
     7
// http://www.boost.org/LICENSE_1_0.txt)
williamr@2
     8
williamr@2
     9
//    Authors: Jaakko Järvi (jajarvi at osl.iu.edu)
williamr@2
    10
//             Jeremiah Willcock (jewillco at osl.iu.edu)
williamr@2
    11
//             Andrew Lumsdaine (lums at osl.iu.edu)
williamr@2
    12
williamr@2
    13
williamr@2
    14
#ifndef BOOST_UTILITY_ENABLE_IF_HPP
williamr@2
    15
#define BOOST_UTILITY_ENABLE_IF_HPP
williamr@2
    16
williamr@2
    17
#include "boost/config.hpp"
williamr@2
    18
williamr@2
    19
// Even the definition of enable_if causes problems on some compilers,
williamr@2
    20
// so it's macroed out for all compilers that do not support SFINAE
williamr@2
    21
williamr@2
    22
#ifndef BOOST_NO_SFINAE
williamr@2
    23
williamr@2
    24
namespace boost
williamr@2
    25
{
williamr@2
    26
 
williamr@2
    27
  template <bool B, class T = void>
williamr@2
    28
  struct enable_if_c {
williamr@2
    29
    typedef T type;
williamr@2
    30
  };
williamr@2
    31
williamr@2
    32
  template <class T>
williamr@2
    33
  struct enable_if_c<false, T> {};
williamr@2
    34
williamr@2
    35
  template <class Cond, class T = void> 
williamr@2
    36
  struct enable_if : public enable_if_c<Cond::value, T> {};
williamr@2
    37
williamr@2
    38
  template <bool B, class T>
williamr@2
    39
  struct lazy_enable_if_c {
williamr@2
    40
    typedef typename T::type type;
williamr@2
    41
  };
williamr@2
    42
williamr@2
    43
  template <class T>
williamr@2
    44
  struct lazy_enable_if_c<false, T> {};
williamr@2
    45
williamr@2
    46
  template <class Cond, class T> 
williamr@2
    47
  struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
williamr@2
    48
williamr@2
    49
williamr@2
    50
  template <bool B, class T = void>
williamr@2
    51
  struct disable_if_c {
williamr@2
    52
    typedef T type;
williamr@2
    53
  };
williamr@2
    54
williamr@2
    55
  template <class T>
williamr@2
    56
  struct disable_if_c<true, T> {};
williamr@2
    57
williamr@2
    58
  template <class Cond, class T = void> 
williamr@2
    59
  struct disable_if : public disable_if_c<Cond::value, T> {};
williamr@2
    60
williamr@2
    61
  template <bool B, class T>
williamr@2
    62
  struct lazy_disable_if_c {
williamr@2
    63
    typedef typename T::type type;
williamr@2
    64
  };
williamr@2
    65
williamr@2
    66
  template <class T>
williamr@2
    67
  struct lazy_disable_if_c<true, T> {};
williamr@2
    68
williamr@2
    69
  template <class Cond, class T> 
williamr@2
    70
  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
williamr@2
    71
williamr@2
    72
} // namespace boost
williamr@2
    73
williamr@2
    74
#else
williamr@2
    75
williamr@2
    76
namespace boost {
williamr@2
    77
williamr@2
    78
  namespace detail { typedef void enable_if_default_T; }
williamr@2
    79
williamr@2
    80
  template <typename T>
williamr@2
    81
  struct enable_if_does_not_work_on_this_compiler;
williamr@2
    82
williamr@2
    83
  template <bool B, class T = detail::enable_if_default_T>
williamr@2
    84
  struct enable_if_c : enable_if_does_not_work_on_this_compiler<T>
williamr@2
    85
  { };
williamr@2
    86
williamr@2
    87
  template <bool B, class T = detail::enable_if_default_T> 
williamr@2
    88
  struct disable_if_c : enable_if_does_not_work_on_this_compiler<T>
williamr@2
    89
  { };
williamr@2
    90
williamr@2
    91
  template <bool B, class T = detail::enable_if_default_T> 
williamr@2
    92
  struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler<T>
williamr@2
    93
  { };
williamr@2
    94
williamr@2
    95
  template <bool B, class T = detail::enable_if_default_T> 
williamr@2
    96
  struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler<T>
williamr@2
    97
  { };
williamr@2
    98
williamr@2
    99
  template <class Cond, class T = detail::enable_if_default_T> 
williamr@2
   100
  struct enable_if : enable_if_does_not_work_on_this_compiler<T>
williamr@2
   101
  { };
williamr@2
   102
williamr@2
   103
  template <class Cond, class T = detail::enable_if_default_T> 
williamr@2
   104
  struct disable_if : enable_if_does_not_work_on_this_compiler<T>
williamr@2
   105
  { };
williamr@2
   106
williamr@2
   107
  template <class Cond, class T = detail::enable_if_default_T> 
williamr@2
   108
  struct lazy_enable_if : enable_if_does_not_work_on_this_compiler<T>
williamr@2
   109
  { };
williamr@2
   110
williamr@2
   111
  template <class Cond, class T = detail::enable_if_default_T> 
williamr@2
   112
  struct lazy_disable_if : enable_if_does_not_work_on_this_compiler<T>
williamr@2
   113
  { };
williamr@2
   114
williamr@2
   115
} // namespace boost
williamr@2
   116
williamr@2
   117
#endif // BOOST_NO_SFINAE
williamr@2
   118
williamr@2
   119
#endif