git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
97 lines
7.2 KiB
HTML
97 lines
7.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>EO: compatibility.h Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.3.9.1 -->
|
|
<div class="qindex"> <form class="search" action="search.php" method="get">
|
|
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
|
|
<div class="nav">
|
|
<a class="el" href="dir_000000.html">src</a> / <a class="el" href="dir_000011.html">utils</a></div>
|
|
<h1>compatibility.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</span>
|
|
00002 <span class="comment"></span>
|
|
00003 <span class="comment"> -----------------------------------------------------------------------------</span>
|
|
00004 <span class="comment"> compatibility.h</span>
|
|
00005 <span class="comment"> File to store some compiler specific stuff in. Currently handles, or </span>
|
|
00006 <span class="comment"> least tries to handle the min() max() problems when using MSVC</span>
|
|
00007 <span class="comment"></span>
|
|
00008 <span class="comment"></span>
|
|
00009 <span class="comment"> (c) Maarten Keijzer (mak@dhi.dk) and GeNeura Team, 1999, 2000</span>
|
|
00010 <span class="comment"> </span>
|
|
00011 <span class="comment"> This library is free software; you can redistribute it and/or</span>
|
|
00012 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>
|
|
00013 <span class="comment"> License as published by the Free Software Foundation; either</span>
|
|
00014 <span class="comment"> version 2 of the License, or (at your option) any later version.</span>
|
|
00015 <span class="comment"></span>
|
|
00016 <span class="comment"> This library is distributed in the hope that it will be useful,</span>
|
|
00017 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
|
00018 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
|
|
00019 <span class="comment"> Lesser General Public License for more details.</span>
|
|
00020 <span class="comment"></span>
|
|
00021 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>
|
|
00022 <span class="comment"> License along with this library; if not, write to the Free Software</span>
|
|
00023 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
|
|
00024 <span class="comment"></span>
|
|
00025 <span class="comment"> Contact: todos@geneura.ugr.es, http://geneura.ugr.es</span>
|
|
00026 <span class="comment"> */</span>
|
|
00027
|
|
00028 <span class="preprocessor">#ifndef COMPAT_H</span>
|
|
00029 <span class="preprocessor"></span><span class="preprocessor">#define COMPAT_H</span>
|
|
00030 <span class="preprocessor"></span>
|
|
00031 <span class="preprocessor">#include <string></span>
|
|
00032 <span class="preprocessor">#include <iostream></span>
|
|
00033
|
|
00034 <span class="preprocessor">#ifdef __GNUC__</span>
|
|
00035 <span class="preprocessor"></span><span class="preprocessor">#if __GNUC__ < 3</span>
|
|
00036 <span class="preprocessor"></span> <span class="comment">// check for stdlibc++v3 which does have ios_base</span>
|
|
00037 <span class="preprocessor"> #ifndef _CPP_BITS_IOSBASE_H </span>
|
|
00038 <span class="preprocessor"></span> <span class="keyword">typedef</span> ios ios_base; <span class="comment">// not currently defined in GCC</span>
|
|
00039 <span class="preprocessor"> #endif</span>
|
|
00040 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
00041 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
00042 <span class="preprocessor"></span>
|
|
00043 <span class="preprocessor">#if defined(_MSC_VER) && (_MSC_VER < 1300)</span>
|
|
00044 <span class="preprocessor"></span><span class="comment">/* </span>
|
|
00045 <span class="comment">Maarten: added this code here because Mirkosoft has the</span>
|
|
00046 <span class="comment">nasty habit of #define min and max in stdlib.h (and windows.h)</span>
|
|
00047 <span class="comment">I'm trying to undo this horrible macro magic (microsoft yet macrohard)</span>
|
|
00048 <span class="comment">here. Sure hope it works</span>
|
|
00049 <span class="comment">Olivier: this has been removed in .NET :) One step more standard...</span>
|
|
00050 <span class="comment">*/</span>
|
|
00051 <span class="preprocessor">#pragma warning(disable:4786)</span>
|
|
00052 <span class="preprocessor"></span>
|
|
00053 <span class="preprocessor">#include <stdlib.h></span>
|
|
00054
|
|
00055 <span class="preprocessor">#ifdef min</span>
|
|
00056 <span class="preprocessor"></span><span class="preprocessor">#undef min</span>
|
|
00057 <span class="preprocessor"></span><span class="preprocessor">#undef max // as they come in std::pairs</span>
|
|
00058 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
00059 <span class="preprocessor"></span>
|
|
00060 <span class="comment">// add min and max to std...</span>
|
|
00061 <span class="keyword">namespace </span>std
|
|
00062 {
|
|
00063 <span class="keyword">template</span> <<span class="keyword">class</span> T> <span class="keyword">const</span> T& min(<span class="keyword">const</span> T& a, <span class="keyword">const</span> T& b)
|
|
00064 {
|
|
00065 <span class="keywordflow">if</span>(a < b)
|
|
00066 <span class="keywordflow">return</span> a;
|
|
00067 <span class="comment">// else</span>
|
|
00068 <span class="keywordflow">return</span> b;
|
|
00069 }
|
|
00070
|
|
00071 <span class="keyword">template</span> <<span class="keyword">class</span> T> <span class="keyword">const</span> T& max(<span class="keyword">const</span> T& a, <span class="keyword">const</span> T& b)
|
|
00072 {
|
|
00073 <span class="keywordflow">if</span>(a > b)
|
|
00074 <span class="keywordflow">return</span> a;
|
|
00075 <span class="comment">// else</span>
|
|
00076 <span class="keywordflow">return</span> b;
|
|
00077 }
|
|
00078 }
|
|
00079
|
|
00080 <span class="preprocessor">#endif</span>
|
|
00081 <span class="preprocessor"></span> <span class="comment">// _MSC_VER</span>
|
|
00082 <span class="preprocessor">#endif </span>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:34 2006 for EO by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
|
|
</body>
|
|
</html>
|