00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_std_H
00010 #define ThePEG_std_H
00011
00025 #include <map>
00026 #include <set>
00027 #include <string>
00028 #include <vector>
00029 #include <list>
00030 #include <iostream>
00031 #include <fstream>
00032 #include <sstream>
00033 #include <iomanip>
00034 #include <stack>
00035 #include <utility>
00036 #include <typeinfo>
00037 #include <stdexcept>
00038 #include <cmath>
00039
00040 namespace std {
00041
00048 template <>
00049 struct less<const type_info *> :
00050 public binary_function<const type_info *, const type_info *, bool>
00051 {
00056 bool operator()(const type_info * x, const type_info * y) const {
00057 return x->before(*y); }
00058 };
00061 }
00062
00064
00065 extern "C" int isnan(double) throw();
00066 extern "C" int isinf(double) throw();
00069 namespace ThePEG {
00070
00071 using std::deque;
00072 using std::stack;
00073 using std::vector;
00074 using std::multiset;
00075 using std::set;
00076 using std::map;
00077 using std::list;
00078 using std::multimap;
00079 using std::pair;
00080 using std::make_pair;
00081 using std::less;
00082 using std::string;
00083 using std::type_info;
00084 using std::exception;
00085 using std::range_error;
00086 using std::ios;
00087 using std::ostream;
00088 using std::istream;
00089 using std::ofstream;
00090 using std::ifstream;
00091 using std::ostringstream;
00092 using std::istringstream;
00093 using std::cin;
00094 using std::cout;
00095 using std::cerr;
00096 using std::endl;
00097 using std::flush;
00098 using std::setprecision;
00099 using std::setw;
00100 using std::swap;
00101 using std::min;
00102 using std::max;
00103 using std::mem_fun;
00104 using std::sqrt;
00105 using std::pow;
00106 using std::atan2;
00107
00109 inline double sqrt(int x) {
00110 return std::sqrt(double(x));
00111 }
00112
00114 template <typename Container, typename Key>
00115 inline bool member(const Container & c, const Key & k) {
00116 return c.find(k) != c.end();
00117 }
00118
00120 template <typename T, typename Key>
00121 inline bool member(const vector<T> & v, const Key & k) {
00122 for ( typename vector<T>::const_iterator i = v.begin(); i != v.end(); ++i )
00123 if ( *i == k ) return true;
00124 return false;
00125
00126 }
00127
00129 template <typename Cont>
00130 inline std::insert_iterator<Cont> inserter(Cont & c) {
00131 return std::insert_iterator<Cont>(c, c.end());
00132 }
00133
00135 inline ostream& left(ostream& os) {
00136 os.setf(ios::left, ios::adjustfield);
00137 return os;
00138 }
00139
00141 inline ostream& right(ostream& os) {
00142 os.setf(ios::right, ios::adjustfield);
00143 return os;
00144 }
00145
00146 }
00147
00148 #ifndef ThePEG_WRAP_STL_CONTAINERS
00149
00151 #define ThePEG_DECLARE_SET(VALTYPE,NAME) \
00152 \
00153 typedef set<VALTYPE, less<VALTYPE> > NAME
00154
00156 #define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \
00157 \
00158 typedef multiset<VALTYPE, less<VALTYPE> > NAME
00159
00161 #define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \
00162 \
00163 typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > NAME
00164
00166 #define ThePEG_IMPLEMENT_SET(VALTYPE,NAME)
00167
00169 #define ThePEG_IMPLEMENT_MULTISET(VALTYPE,NAME)
00170
00172 #define ThePEG_IMPLEMENT_MAP(KEYTYPE,VALTYPE,NAME)
00173
00174 #else
00175
00177 #define ThePEG_DECLARE_SET(VALTYPE,NAME) \
00178 class NAME : public set<VALTYPE, less<VALTYPE> > { \
00179 public: \
00180 typedef set<VALTYPE, less<VALTYPE> > SETTYPE; \
00181 NAME(); \
00182 explicit NAME(const key_compare & c, \
00183 const allocator_type & a = allocator_type()); \
00184 template <typename InputIterator> \
00185 NAME(InputIterator first, InputIterator last) \
00186 : SETTYPE(first, last) {} \
00187 template <typename InputIterator> \
00188 NAME(InputIterator first, InputIterator last, const key_compare & c, \
00189 const allocator_type & a = allocator_type()) \
00190 : SETTYPE(first, last, c, a) {} \
00191 NAME(const SETTYPE & s); \
00192 NAME(const NAME & s); \
00193 ~NAME(); \
00194 NAME & operator=(const NAME &); \
00195 NAME & operator=(const SETTYPE &); \
00196 pair<iterator,bool> insert(const value_type & x); \
00197 iterator insert(iterator position, const value_type & x); \
00198 template <typename InputIterator> \
00199 void insert(InputIterator first, InputIterator last) { \
00200 SETTYPE::insert(first, last); \
00201 } \
00202 void erase(iterator position); \
00203 size_type erase(const key_type & x); \
00204 void erase(iterator first, iterator last); \
00205 void clear(); \
00206 iterator find(const key_type & x) const; \
00207 size_type count(const key_type & x) const; \
00208 iterator lower_bound(const key_type & x) const; \
00209 iterator upper_bound(const key_type & x) const; \
00210 pair<iterator,iterator> equal_range(const key_type & x) const; \
00211 }
00212
00213
00215 #define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \
00216 class NAME : \
00217 public multiset<VALTYPE, less<VALTYPE> > { \
00218 public: \
00219 typedef multiset<VALTYPE, less<VALTYPE> > SETTYPE;\
00220 NAME(); \
00221 explicit NAME(const key_compare & c, \
00222 const allocator_type & a = allocator_type()); \
00223 template <typename InputIterator> \
00224 NAME(InputIterator first, InputIterator last) \
00225 : SETTYPE(first, last) {} \
00226 template <typename InputIterator> \
00227 NAME(InputIterator first, InputIterator last, const key_compare & c, \
00228 const allocator_type & a = allocator_type()) \
00229 : SETTYPE(first, last, c, a) {} \
00230 NAME(const SETTYPE & s); \
00231 NAME(const NAME & s); \
00232 ~NAME(); \
00233 NAME & operator=(const NAME &); \
00234 NAME & operator=(const SETTYPE &); \
00235 iterator insert(const value_type & x); \
00236 iterator insert(iterator position, const value_type & x); \
00237 template <typename InputIterator> \
00238 void insert(InputIterator first, InputIterator last) { \
00239 SETTYPE::insert(first, last); \
00240 } \
00241 void erase(iterator position); \
00242 size_type erase(const key_type & x); \
00243 void erase(iterator first, iterator last); \
00244 void clear(); \
00245 iterator find(const key_type & x) const; \
00246 size_type count(const key_type & x) const; \
00247 iterator lower_bound(const key_type & x) const; \
00248 iterator upper_bound(const key_type & x) const; \
00249 pair<iterator,iterator> equal_range(const key_type & x) const; \
00250 }
00251
00252
00254 #define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \
00255 class NAME : \
00256 public map<KEYTYPE, VALTYPE, less<KEYTYPE> > { \
00257 public: \
00258 typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > MAPTYPE; \
00259 NAME(); \
00260 explicit NAME(const key_compare & c, \
00261 const allocator_type & a = allocator_type()); \
00262 template <typename InputIterator> \
00263 NAME(InputIterator first, InputIterator last) \
00264 : MAPTYPE(first, last) {} \
00265 template <typename InputIterator> \
00266 NAME(InputIterator first, InputIterator last, const key_compare & c, \
00267 const allocator_type & a = allocator_type()) \
00268 : MAPTYPE(first, last, c, a) {} \
00269 NAME(const NAME & s); \
00270 NAME(const MAPTYPE & s); \
00271 ~NAME(); \
00272 NAME & operator=(const NAME &); \
00273 NAME & operator=(const MAPTYPE &); \
00274 data_type & operator[](const key_type & k); \
00275 pair<iterator,bool> insert(const value_type & x); \
00276 iterator insert(iterator position, const value_type & x); \
00277 template <typename InputIterator> \
00278 void insert(InputIterator first, InputIterator last) { \
00279 MAPTYPE::insert(first, last); \
00280 } \
00281 void erase(iterator position); \
00282 size_type erase(const key_type & x); \
00283 void erase(iterator first, iterator last); \
00284 void clear(); \
00285 iterator find(const key_type & x); \
00286 const_iterator find(const key_type & x) const; \
00287 size_type count(const key_type & x) const; \
00288 iterator lower_bound(const key_type & x); \
00289 const_iterator lower_bound(const key_type & x) const; \
00290 iterator upper_bound(const key_type & x); \
00291 const_iterator upper_bound(const key_type & x) const; \
00292 pair<iterator,iterator> equal_range(const key_type & x); \
00293 pair<const_iterator,const_iterator> \
00294 equal_range(const key_type & x) const; \
00295 }
00296
00297
00299 #define ThePEG_IMPLEMENT_SET(VALTYPE,NAME) \
00300 NAME::NAME() {} \
00301 NAME::NAME(const key_compare & c, const allocator_type & a) \
00302 :SETTYPE(c, a) {} \
00303 NAME::NAME(const NAME & x) : SETTYPE(x) {} \
00304 NAME::NAME(const SETTYPE & x) : SETTYPE(x) {} \
00305 NAME::~NAME() {} \
00306 NAME & NAME::operator=(const NAME & x) { \
00307 SETTYPE::operator=(x); \
00308 return *this; \
00309 } \
00310 NAME & NAME::operator=(const SETTYPE & x) { \
00311 SETTYPE::operator=(x); \
00312 return *this; \
00313 } \
00314 pair<NAME::iterator,bool> NAME::insert(const value_type & x) { \
00315 return SETTYPE::insert(x); \
00316 } \
00317 NAME::iterator NAME::insert(iterator position, const value_type & x) { \
00318 return SETTYPE::insert(position, x); \
00319 } \
00320 void NAME::erase(iterator position) { \
00321 SETTYPE::erase(position); \
00322 } \
00323 NAME::size_type NAME::erase(const key_type & x) { \
00324 return SETTYPE::erase(x); \
00325 } \
00326 void NAME::erase(iterator first, iterator last) { \
00327 SETTYPE::erase(first, last); \
00328 } \
00329 void NAME::clear() { \
00330 SETTYPE::clear(); \
00331 } \
00332 NAME::iterator NAME::find(const key_type & x) const { \
00333 return SETTYPE::find(x); \
00334 } \
00335 NAME::size_type NAME::count(const key_type & x) const { \
00336 return SETTYPE::count(x); \
00337 } \
00338 NAME::iterator NAME::lower_bound(const key_type & x) const { \
00339 return SETTYPE::lower_bound(x); \
00340 } \
00341 NAME::iterator NAME::upper_bound(const key_type & x) const { \
00342 return SETTYPE::upper_bound(x); \
00343 } \
00344 pair<NAME::iterator,NAME::iterator> \
00345 NAME::equal_range(const key_type & x) const { \
00346 return SETTYPE::equal_range(x); \
00347 } \
00348
00349
00351 #define ThePEG_IMPLEMENT_MULTISET(VALTYPE,NAME) \
00352 NAME::NAME() {} \
00353 NAME::NAME(const key_compare & c, const allocator_type & a) \
00354 :SETTYPE(c, a) {} \
00355 NAME::NAME(const NAME & x) : SETTYPE(x) {} \
00356 NAME::NAME(const SETTYPE & x) : SETTYPE(x) {} \
00357 NAME::~NAME() {} \
00358 NAME & NAME::operator=(const NAME & x) { \
00359 SETTYPE::operator=(x); \
00360 return *this; \
00361 } \
00362 NAME & NAME::operator=(const SETTYPE & x) { \
00363 SETTYPE::operator=(x); \
00364 return *this; \
00365 } \
00366 NAME::iterator NAME::insert(const value_type & x) { \
00367 return SETTYPE::insert(x); \
00368 } \
00369 NAME::iterator NAME::insert(iterator position, const value_type & x) { \
00370 return SETTYPE::insert(position, x); \
00371 } \
00372 void NAME::erase(iterator position) { \
00373 SETTYPE::erase(position); \
00374 } \
00375 NAME::size_type NAME::erase(const key_type & x) { \
00376 return SETTYPE::erase(x); \
00377 } \
00378 void NAME::erase(iterator first, iterator last) { \
00379 SETTYPE::erase(first, last); \
00380 } \
00381 void NAME::clear() { \
00382 SETTYPE::clear(); \
00383 } \
00384 NAME::iterator NAME::find(const key_type & x) const { \
00385 return SETTYPE::find(x); \
00386 } \
00387 NAME::size_type NAME::count(const key_type & x) const { \
00388 return SETTYPE::count(x); \
00389 } \
00390 NAME::iterator NAME::lower_bound(const key_type & x) const { \
00391 return SETTYPE::lower_bound(x); \
00392 } \
00393 NAME::iterator NAME::upper_bound(const key_type & x) const { \
00394 return SETTYPE::upper_bound(x); \
00395 } \
00396 pair<NAME::iterator,NAME::iterator> \
00397 NAME::equal_range(const key_type & x) const { \
00398 return SETTYPE::equal_range(x); \
00399 } \
00400
00401
00403 #define ThePEG_IMPLEMENT_MAP(KEYTYPE,VALTYPE,NAME) \
00404 NAME::NAME() {} \
00405 NAME::NAME(const key_compare & c, const allocator_type & a) \
00406 :MAPTYPE(c, a) {} \
00407 NAME::NAME(const NAME & x) : MAPTYPE(x) {} \
00408 NAME::NAME(const MAPTYPE & x) : MAPTYPE(x) {} \
00409 NAME::~NAME() {} \
00410 NAME & NAME::operator=(const NAME & x) { \
00411 MAPTYPE::operator=(x); \
00412 return *this; \
00413 } \
00414 NAME & NAME::operator=(const MAPTYPE & x) { \
00415 MAPTYPE::operator=(x); \
00416 return *this; \
00417 } \
00418 pair<NAME::iterator,bool> NAME::insert(const value_type & x) { \
00419 return MAPTYPE::insert(x); \
00420 } \
00421 NAME::iterator NAME::insert(iterator position, const value_type & x) { \
00422 return MAPTYPE::insert(position, x); \
00423 } \
00424 void NAME::erase(iterator position) { \
00425 MAPTYPE::erase(position); \
00426 } \
00427 NAME::size_type NAME::erase(const key_type & x) { \
00428 return MAPTYPE::erase(x); \
00429 } \
00430 void NAME::erase(iterator first, iterator last) { \
00431 MAPTYPE::erase(first, last); \
00432 } \
00433 void NAME::clear() { \
00434 MAPTYPE::clear(); \
00435 } \
00436 NAME::iterator NAME::find(const key_type & x) { \
00437 return MAPTYPE::find(x); \
00438 } \
00439 NAME::const_iterator NAME::find(const key_type & x) const { \
00440 return MAPTYPE::find(x); \
00441 } \
00442 NAME::size_type NAME::count(const key_type & x) const { \
00443 return MAPTYPE::count(x); \
00444 } \
00445 NAME::iterator NAME::lower_bound(const key_type & x) { \
00446 return MAPTYPE::lower_bound(x); \
00447 } \
00448 NAME::const_iterator NAME::lower_bound(const key_type & x) const { \
00449 return MAPTYPE::lower_bound(x); \
00450 } \
00451 NAME::iterator NAME::upper_bound(const key_type & x) { \
00452 return MAPTYPE::upper_bound(x); \
00453 } \
00454 NAME::const_iterator NAME::upper_bound(const key_type & x) const { \
00455 return MAPTYPE::upper_bound(x); \
00456 } \
00457 pair<NAME::iterator,NAME::iterator> \
00458 NAME::equal_range(const key_type & x) { \
00459 return MAPTYPE::equal_range(x); \
00460 } \
00461 pair<NAME::const_iterator,NAME::const_iterator> \
00462 NAME::equal_range(const key_type & x) const { \
00463 return MAPTYPE::equal_range(x); \
00464 } \
00465 NAME::data_type & NAME::operator[](const key_type & k) { \
00466 return MAPTYPE::operator[](k); \
00467 } \
00468
00469 #endif
00470
00471
00472 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
00473
00474 #endif
00475
00476 #endif