lemon/bits/utility.h
changeset 220 a5d8c039f218
parent 217 b67149f0e675
child 221 64613d8fae28
     1.1 --- a/lemon/bits/utility.h	Mon Jul 14 15:40:24 2008 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,140 +0,0 @@
     1.4 -/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.5 - *
     1.6 - * This file is a part of LEMON, a generic C++ optimization library.
     1.7 - *
     1.8 - * Copyright (C) 2003-2008
     1.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 - *
    1.12 - * Permission to use, modify and distribute this software is granted
    1.13 - * provided that this copyright notice appears in all copies. For
    1.14 - * precise terms see the accompanying LICENSE file.
    1.15 - *
    1.16 - * This software is provided "AS IS" with no warranty of any kind,
    1.17 - * express or implied, and with no claim as to its suitability for any
    1.18 - * purpose.
    1.19 - *
    1.20 - */
    1.21 -
    1.22 -// This file contains a modified version of the enable_if library from BOOST.
    1.23 -// See the appropriate copyright notice below.
    1.24 -
    1.25 -// Boost enable_if library
    1.26 -
    1.27 -// Copyright 2003 (c) The Trustees of Indiana University.
    1.28 -
    1.29 -// Use, modification, and distribution is subject to the Boost Software
    1.30 -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.31 -// http://www.boost.org/LICENSE_1_0.txt)
    1.32 -
    1.33 -//    Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
    1.34 -//             Jeremiah Willcock (jewillco at osl.iu.edu)
    1.35 -//             Andrew Lumsdaine (lums at osl.iu.edu)
    1.36 -
    1.37 -
    1.38 -#ifndef LEMON_BITS_UTILITY_H
    1.39 -#define LEMON_BITS_UTILITY_H
    1.40 -
    1.41 -///\file
    1.42 -///\brief Miscellaneous basic utilities
    1.43 -///
    1.44 -///\todo Please rethink the organisation of the basic files like this.
    1.45 -///E.g. this file might be merged with invalid.h.
    1.46 -
    1.47 -
    1.48 -namespace lemon
    1.49 -{
    1.50 -
    1.51 -  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
    1.52 -
    1.53 -  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
    1.54 -  ///
    1.55 -  ///\sa False
    1.56 -  ///
    1.57 -  /// \todo This should go to a separate "basic_types.h" (or something)
    1.58 -  /// file.
    1.59 -  struct True {
    1.60 -    ///\e
    1.61 -    static const bool value = true;
    1.62 -  };
    1.63 -
    1.64 -  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
    1.65 -
    1.66 -  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
    1.67 -  ///
    1.68 -  ///\sa True
    1.69 -  struct False {
    1.70 -    ///\e
    1.71 -    static const bool value = false;
    1.72 -  };
    1.73 -
    1.74 -
    1.75 -  struct InvalidType {
    1.76 -  };
    1.77 -
    1.78 -  template <typename T>
    1.79 -  struct Wrap {
    1.80 -    const T &value;
    1.81 -    Wrap(const T &t) : value(t) {}
    1.82 -  };
    1.83 -
    1.84 -  /**************** dummy class to avoid ambiguity ****************/
    1.85 -
    1.86 -  template<int T> struct dummy { dummy(int) {} };
    1.87 -
    1.88 -  /**************** enable_if from BOOST ****************/
    1.89 -
    1.90 -  template <typename Type, typename T = void>
    1.91 -  struct exists {
    1.92 -    typedef T type;
    1.93 -  };
    1.94 -
    1.95 -
    1.96 -  template <bool B, class T = void>
    1.97 -  struct enable_if_c {
    1.98 -    typedef T type;
    1.99 -  };
   1.100 -
   1.101 -  template <class T>
   1.102 -  struct enable_if_c<false, T> {};
   1.103 -
   1.104 -  template <class Cond, class T = void>
   1.105 -  struct enable_if : public enable_if_c<Cond::value, T> {};
   1.106 -
   1.107 -  template <bool B, class T>
   1.108 -  struct lazy_enable_if_c {
   1.109 -    typedef typename T::type type;
   1.110 -  };
   1.111 -
   1.112 -  template <class T>
   1.113 -  struct lazy_enable_if_c<false, T> {};
   1.114 -
   1.115 -  template <class Cond, class T>
   1.116 -  struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
   1.117 -
   1.118 -
   1.119 -  template <bool B, class T = void>
   1.120 -  struct disable_if_c {
   1.121 -    typedef T type;
   1.122 -  };
   1.123 -
   1.124 -  template <class T>
   1.125 -  struct disable_if_c<true, T> {};
   1.126 -
   1.127 -  template <class Cond, class T = void>
   1.128 -  struct disable_if : public disable_if_c<Cond::value, T> {};
   1.129 -
   1.130 -  template <bool B, class T>
   1.131 -  struct lazy_disable_if_c {
   1.132 -    typedef typename T::type type;
   1.133 -  };
   1.134 -
   1.135 -  template <class T>
   1.136 -  struct lazy_disable_if_c<true, T> {};
   1.137 -
   1.138 -  template <class Cond, class T>
   1.139 -  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   1.140 -
   1.141 -} // namespace lemon
   1.142 -
   1.143 -#endif