MADNESS  version 0.9
muParserFixes.h
Go to the documentation of this file.
1 /*
2  __________
3  _____ __ __\______ \_____ _______ ______ ____ _______
4  / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
5  | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
6  |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
7  \/ \/ \/ \/
8  Copyright (C) 2004-2008 Ingo Berg
9 
10  Permission is hereby granted, free of charge, to any person obtaining a copy of this
11  software and associated documentation files (the "Software"), to deal in the Software
12  without restriction, including without limitation the rights to use, copy, modify,
13  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
14  permit persons to whom the Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in all copies or
17  substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
20  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25 
26 #ifndef MU_PARSER_FIXES_H
27 #define MU_PARSER_FIXES_H
28 
33 //
34 // Compatibility fixes
35 //
36 
37 //---------------------------------------------------------------------------
38 //
39 // Intel Compiler
40 //
41 //---------------------------------------------------------------------------
42 
43 #ifdef __INTEL_COMPILER
44 
45 // remark #981: operands are evaluated in unspecified order
46 // disabled -> completely pointless if the functions do not have side effects
47 //
48 #pragma warning(disable:981)
49 
50 // remark #383: value copied to temporary, reference to temporary used
51 #pragma warning(disable:383)
52 
53 // remark #1572: floating-point equality and inequality comparisons are unreliable
54 // disabled -> everyone knows it, the parser passes this problem
55 // deliberately to the user
56 #pragma warning(disable:1572)
57 
58 #endif
59 
60 
61 //---------------------------------------------------------------------------
62 //
63 // MSVC6
64 //
65 //---------------------------------------------------------------------------
66 
67 
68 #if defined(_MSC_VER) && _MSC_VER==1200
69 
77 #define auto_ptr _my_auto_ptr
78 
79 // This is another stupidity that needs to be undone in order to de-pollute
80 // the global namespace!
81 #undef min
82 #undef max
83 
84 
85 namespace std
86 {
87  typedef ::size_t size_t;
88 
89  //---------------------------------------------------------------------------
96  inline int rand(void)
97  {
98  return ::rand();
99  }
100 
101  //---------------------------------------------------------------------------
108  inline size_t strlen(const char *szMsg)
109  {
110  return ::strlen(szMsg);
111  }
112 
113  //---------------------------------------------------------------------------
120  inline int strncmp(const char *a, const char *b, size_t len)
121  {
122  return ::strncmp(a,b,len);
123  }
124 
125  //---------------------------------------------------------------------------
126  template<typename T>
127  T max(T a, T b)
128  {
129  return (a>b) ? a : b;
130  }
131 
132  //---------------------------------------------------------------------------
133  template<typename T>
134  T min(T a, T b)
135  {
136  return (a<b) ? a : b;
137  }
138 
139  //---------------------------------------------------------------------------
145  template<class _Ty>
146  class _my_auto_ptr
147  {
148  public:
149  typedef _Ty element_type;
150 
151  explicit _my_auto_ptr(_Ty *_Ptr = 0)
152  :_Myptr(_Ptr)
153  {}
154 
155  _my_auto_ptr(_my_auto_ptr<_Ty>& _Right)
156  :_Myptr(_Right.release())
157  {}
158 
159  template<class _Other>
160  operator _my_auto_ptr<_Other>()
161  {
162  return (_my_auto_ptr<_Other>(*this));
163  }
164 
165  template<class _Other>
166  _my_auto_ptr<_Ty>& operator=(_my_auto_ptr<_Other>& _Right)
167  {
168  reset(_Right.release());
169  return (*this);
170  }
171 
172  ~auto_ptr() { delete _Myptr; }
173  _Ty& operator*() const { return (*_Myptr); }
174  _Ty *operator->() const { return (&**this); }
175  _Ty *get() const { return (_Myptr); }
176 
177  _Ty *release()
178  {
179  _Ty *_Tmp = _Myptr;
180  _Myptr = 0;
181  return (_Tmp);
182  }
183 
184  void reset(_Ty* _Ptr = 0)
185  {
186  if (_Ptr != _Myptr)
187  delete _Myptr;
188  _Myptr = _Ptr;
189  }
190 
191  private:
192  _Ty *_Myptr;
193  }; // class _my_auto_ptr
194 } // namespace std
195 
196 #endif // Microsoft Visual Studio Version 6.0
197 
198 #endif // include guard
199 
200 
Definition: mpreal.h:3066
const mpreal operator*(const mpreal &a, const mpreal &b)
Definition: mpreal.h:1177
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
#define max(a, b)
Definition: lda.h:53
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
FLOAT b(int j, FLOAT z)
Definition: y1.cc:79