49 struct less<const type_info *> :
50 public binary_function<const type_info *, const type_info *, bool>
56 bool operator()(
const type_info * x,
const type_info * y)
const {
57 return x->before(*y); }
65 #if defined __APPLE__ && defined __MACH__ 66 extern "C" int isnan(
double)
throw();
67 extern "C" int isinf(
double)
throw();
87 using std::range_error;
93 using std::ostringstream;
94 using std::istringstream;
100 using std::setprecision;
116 template <
typename Container,
typename Key>
117 inline bool member(
const Container & c,
const Key & k) {
118 return c.find(k) != c.end();
122 template <
typename T,
typename Key>
123 inline bool member(
const vector<T> & v,
const Key & k) {
124 for (
typename vector<T>::const_iterator i = v.begin(); i != v.end(); ++i )
125 if ( *i == k )
return true;
131 template <
typename Cont>
132 inline std::insert_iterator<Cont>
inserter(Cont & c) {
133 return std::insert_iterator<Cont>(c, c.end());
139 template <
typename T,
typename A>
140 inline std::back_insert_iterator< vector<T,A> >
inserter(vector<T,A> & v) {
141 return back_inserter(v);
146 template <
typename T,
typename A>
147 inline std::back_insert_iterator< deque<T,A> >
inserter(deque<T,A> & v) {
148 return back_inserter(v);
152 inline ostream&
left(ostream& os) {
158 inline ostream&
right(ostream& os) {
165 #ifndef ThePEG_WRAP_STL_CONTAINERS 168 #define ThePEG_DECLARE_SET(VALTYPE,NAME) \ 170 typedef set<VALTYPE, less<VALTYPE> > NAME 173 #define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \ 175 typedef multiset<VALTYPE, less<VALTYPE> > NAME 178 #define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \ 180 typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > NAME 183 #define ThePEG_IMPLEMENT_SET(VALTYPE,NAME) 186 #define ThePEG_IMPLEMENT_MULTISET(VALTYPE,NAME) 189 #define ThePEG_IMPLEMENT_MAP(KEYTYPE,VALTYPE,NAME) 194 #define ThePEG_DECLARE_SET(VALTYPE,NAME) \ 195 class NAME : public set<VALTYPE, less<VALTYPE> > { \ 197 typedef set<VALTYPE, less<VALTYPE> > SETTYPE; \ 199 explicit NAME(const key_compare & c, \ 200 const allocator_type & a = allocator_type()); \ 201 template <typename InputIterator> \ 202 NAME(InputIterator first, InputIterator last) \ 203 : SETTYPE(first, last) {} \ 204 template <typename InputIterator> \ 205 NAME(InputIterator first, InputIterator last, const key_compare & c, \ 206 const allocator_type & a = allocator_type()) \ 207 : SETTYPE(first, last, c, a) {} \ 208 NAME(const SETTYPE & s); \ 209 NAME(const NAME & s); \ 211 NAME & operator=(const NAME &); \ 212 NAME & operator=(const SETTYPE &); \ 213 pair<iterator,bool> insert(const value_type & x); \ 214 iterator insert(iterator position, const value_type & x); \ 215 template <typename InputIterator> \ 216 void insert(InputIterator first, InputIterator last) { \ 217 SETTYPE::insert(first, last); \ 219 void erase(iterator position); \ 220 size_type erase(const key_type & x); \ 221 void erase(iterator first, iterator last); \ 223 iterator find(const key_type & x) const; \ 224 size_type count(const key_type & x) const; \ 225 iterator lower_bound(const key_type & x) const; \ 226 iterator upper_bound(const key_type & x) const; \ 227 pair<iterator,iterator> equal_range(const key_type & x) const; \ 232 #define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \ 234 public multiset<VALTYPE, less<VALTYPE> > { \ 236 typedef multiset<VALTYPE, less<VALTYPE> > SETTYPE;\ 238 explicit NAME(const key_compare & c, \ 239 const allocator_type & a = allocator_type()); \ 240 template <typename InputIterator> \ 241 NAME(InputIterator first, InputIterator last) \ 242 : SETTYPE(first, last) {} \ 243 template <typename InputIterator> \ 244 NAME(InputIterator first, InputIterator last, const key_compare & c, \ 245 const allocator_type & a = allocator_type()) \ 246 : SETTYPE(first, last, c, a) {} \ 247 NAME(const SETTYPE & s); \ 248 NAME(const NAME & s); \ 250 NAME & operator=(const NAME &); \ 251 NAME & operator=(const SETTYPE &); \ 252 iterator insert(const value_type & x); \ 253 iterator insert(iterator position, const value_type & x); \ 254 template <typename InputIterator> \ 255 void insert(InputIterator first, InputIterator last) { \ 256 SETTYPE::insert(first, last); \ 258 void erase(iterator position); \ 259 size_type erase(const key_type & x); \ 260 void erase(iterator first, iterator last); \ 262 iterator find(const key_type & x) const; \ 263 size_type count(const key_type & x) const; \ 264 iterator lower_bound(const key_type & x) const; \ 265 iterator upper_bound(const key_type & x) const; \ 266 pair<iterator,iterator> equal_range(const key_type & x) const; \ 271 #define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \ 273 public map<KEYTYPE, VALTYPE, less<KEYTYPE> > { \ 275 typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > MAPTYPE; \ 277 explicit NAME(const key_compare & c, \ 278 const allocator_type & a = allocator_type()); \ 279 template <typename InputIterator> \ 280 NAME(InputIterator first, InputIterator last) \ 281 : MAPTYPE(first, last) {} \ 282 template <typename InputIterator> \ 283 NAME(InputIterator first, InputIterator last, const key_compare & c, \ 284 const allocator_type & a = allocator_type()) \ 285 : MAPTYPE(first, last, c, a) {} \ 286 NAME(const NAME & s); \ 287 NAME(const MAPTYPE & s); \ 289 NAME & operator=(const NAME &); \ 290 NAME & operator=(const MAPTYPE &); \ 291 data_type & operator[](const key_type & k); \ 292 pair<iterator,bool> insert(const value_type & x); \ 293 iterator insert(iterator position, const value_type & x); \ 294 template <typename InputIterator> \ 295 void insert(InputIterator first, InputIterator last) { \ 296 MAPTYPE::insert(first, last); \ 298 void erase(iterator position); \ 299 size_type erase(const key_type & x); \ 300 void erase(iterator first, iterator last); \ 302 iterator find(const key_type & x); \ 303 const_iterator find(const key_type & x) const; \ 304 size_type count(const key_type & x) const; \ 305 iterator lower_bound(const key_type & x); \ 306 const_iterator lower_bound(const key_type & x) const; \ 307 iterator upper_bound(const key_type & x); \ 308 const_iterator upper_bound(const key_type & x) const; \ 309 pair<iterator,iterator> equal_range(const key_type & x); \ 310 pair<const_iterator,const_iterator> \ 311 equal_range(const key_type & x) const; \ 316 #define ThePEG_IMPLEMENT_SET(VALTYPE,NAME) \ 318 NAME::NAME(const key_compare & c, const allocator_type & a) \ 320 NAME::NAME(const NAME & x) : SETTYPE(x) {} \ 321 NAME::NAME(const SETTYPE & x) : SETTYPE(x) {} \ 323 NAME & NAME::operator=(const NAME & x) { \ 324 SETTYPE::operator=(x); \ 327 NAME & NAME::operator=(const SETTYPE & x) { \ 328 SETTYPE::operator=(x); \ 331 pair<NAME::iterator,bool> NAME::insert(const value_type & x) { \ 332 return SETTYPE::insert(x); \ 334 NAME::iterator NAME::insert(iterator position, const value_type & x) { \ 335 return SETTYPE::insert(position, x); \ 337 void NAME::erase(iterator position) { \ 338 SETTYPE::erase(position); \ 340 NAME::size_type NAME::erase(const key_type & x) { \ 341 return SETTYPE::erase(x); \ 343 void NAME::erase(iterator first, iterator last) { \ 344 SETTYPE::erase(first, last); \ 346 void NAME::clear() { \ 349 NAME::iterator NAME::find(const key_type & x) const { \ 350 return SETTYPE::find(x); \ 352 NAME::size_type NAME::count(const key_type & x) const { \ 353 return SETTYPE::count(x); \ 355 NAME::iterator NAME::lower_bound(const key_type & x) const { \ 356 return SETTYPE::lower_bound(x); \ 358 NAME::iterator NAME::upper_bound(const key_type & x) const { \ 359 return SETTYPE::upper_bound(x); \ 361 pair<NAME::iterator,NAME::iterator> \ 362 NAME::equal_range(const key_type & x) const { \ 363 return SETTYPE::equal_range(x); \ 368 #define ThePEG_IMPLEMENT_MULTISET(VALTYPE,NAME) \ 370 NAME::NAME(const key_compare & c, const allocator_type & a) \ 372 NAME::NAME(const NAME & x) : SETTYPE(x) {} \ 373 NAME::NAME(const SETTYPE & x) : SETTYPE(x) {} \ 375 NAME & NAME::operator=(const NAME & x) { \ 376 SETTYPE::operator=(x); \ 379 NAME & NAME::operator=(const SETTYPE & x) { \ 380 SETTYPE::operator=(x); \ 383 NAME::iterator NAME::insert(const value_type & x) { \ 384 return SETTYPE::insert(x); \ 386 NAME::iterator NAME::insert(iterator position, const value_type & x) { \ 387 return SETTYPE::insert(position, x); \ 389 void NAME::erase(iterator position) { \ 390 SETTYPE::erase(position); \ 392 NAME::size_type NAME::erase(const key_type & x) { \ 393 return SETTYPE::erase(x); \ 395 void NAME::erase(iterator first, iterator last) { \ 396 SETTYPE::erase(first, last); \ 398 void NAME::clear() { \ 401 NAME::iterator NAME::find(const key_type & x) const { \ 402 return SETTYPE::find(x); \ 404 NAME::size_type NAME::count(const key_type & x) const { \ 405 return SETTYPE::count(x); \ 407 NAME::iterator NAME::lower_bound(const key_type & x) const { \ 408 return SETTYPE::lower_bound(x); \ 410 NAME::iterator NAME::upper_bound(const key_type & x) const { \ 411 return SETTYPE::upper_bound(x); \ 413 pair<NAME::iterator,NAME::iterator> \ 414 NAME::equal_range(const key_type & x) const { \ 415 return SETTYPE::equal_range(x); \ 420 #define ThePEG_IMPLEMENT_MAP(KEYTYPE,VALTYPE,NAME) \ 422 NAME::NAME(const key_compare & c, const allocator_type & a) \ 424 NAME::NAME(const NAME & x) : MAPTYPE(x) {} \ 425 NAME::NAME(const MAPTYPE & x) : MAPTYPE(x) {} \ 427 NAME & NAME::operator=(const NAME & x) { \ 428 MAPTYPE::operator=(x); \ 431 NAME & NAME::operator=(const MAPTYPE & x) { \ 432 MAPTYPE::operator=(x); \ 435 pair<NAME::iterator,bool> NAME::insert(const value_type & x) { \ 436 return MAPTYPE::insert(x); \ 438 NAME::iterator NAME::insert(iterator position, const value_type & x) { \ 439 return MAPTYPE::insert(position, x); \ 441 void NAME::erase(iterator position) { \ 442 MAPTYPE::erase(position); \ 444 NAME::size_type NAME::erase(const key_type & x) { \ 445 return MAPTYPE::erase(x); \ 447 void NAME::erase(iterator first, iterator last) { \ 448 MAPTYPE::erase(first, last); \ 450 void NAME::clear() { \ 453 NAME::iterator NAME::find(const key_type & x) { \ 454 return MAPTYPE::find(x); \ 456 NAME::const_iterator NAME::find(const key_type & x) const { \ 457 return MAPTYPE::find(x); \ 459 NAME::size_type NAME::count(const key_type & x) const { \ 460 return MAPTYPE::count(x); \ 462 NAME::iterator NAME::lower_bound(const key_type & x) { \ 463 return MAPTYPE::lower_bound(x); \ 465 NAME::const_iterator NAME::lower_bound(const key_type & x) const { \ 466 return MAPTYPE::lower_bound(x); \ 468 NAME::iterator NAME::upper_bound(const key_type & x) { \ 469 return MAPTYPE::upper_bound(x); \ 471 NAME::const_iterator NAME::upper_bound(const key_type & x) const { \ 472 return MAPTYPE::upper_bound(x); \ 474 pair<NAME::iterator,NAME::iterator> \ 475 NAME::equal_range(const key_type & x) { \ 476 return MAPTYPE::equal_range(x); \ 478 pair<NAME::const_iterator,NAME::const_iterator> \ 479 NAME::equal_range(const key_type & x) const { \ 480 return MAPTYPE::equal_range(x); \ 482 NAME::data_type & NAME::operator[](const key_type & k) { \ 483 return MAPTYPE::operator[](k); \ 489 #ifndef ThePEG_TEMPLATES_IN_CC_FILE double sqrt(int x)
Square root of an integer.
bool member(const vector< T > &v, const Key &k)
Check if a given object is a part of a vector.
std::back_insert_iterator< deque< T, A > > inserter(deque< T, A > &v)
Return an insert iterator for a given vector.
This is the main namespace within which all identifiers in ThePEG are declared.
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
ostream & right(ostream &os)
Stream manipulator setting an ostream to right-adjust its ouput.