thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Config
std.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// std.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_std_H
10
#define ThePEG_std_H
11
25
#include <map>
26
#include <set>
27
#include <string>
28
#include <array>
29
#include <vector>
30
#include <list>
31
#include <iostream>
32
#include <fstream>
33
#include <sstream>
34
#include <iomanip>
35
#include <stack>
36
#include <utility>
37
#include <typeinfo>
38
#include <stdexcept>
39
#include <cmath>
40
41
namespace
std
{
42
49
template
<>
50
struct
less<const type_info *> {
55
typedef
type_info first_argument_type;
56
typedef
type_info second_argument_type;
57
typedef
bool
result_type;
58
bool
operator()(
const
type_info * x,
const
type_info * y)
const
{
59
return
x->before(*y); }
60
};
63
}
64
65
namespace
ThePEG
{
66
67
using
std::array;
68
using
std::deque;
69
using
std::stack;
70
using
std::vector;
71
using
std::multiset;
72
using
std::set;
73
using
std::map;
74
using
std::list;
75
using
std::multimap;
76
using
std::pair;
77
using
std::make_pair;
78
using
std::less;
79
using
std::string;
80
using
std::type_info;
81
using
std::exception;
82
using
std::range_error;
83
using
std::ios;
84
using
std::ostream;
85
using
std::istream;
86
using
std::ofstream;
87
using
std::ifstream;
88
using
std::ostringstream;
89
using
std::istringstream;
90
using
std::cin;
91
using
std::cout;
92
using
std::cerr;
93
using
std::endl;
94
using
std::flush;
95
using
std::setprecision;
96
using
std::setw;
97
using
std::swap
;
98
using
std::min;
99
using
std::max;
100
using
std::mem_fn;
101
//using std::mem_fun;
102
using
std::sqrt;
103
//using std::pow;
104
using
std::abs;
105
using
std::atan2;
106
using
std::isfinite;
107
109
template
<
class
ExponentT>
110
inline
constexpr
double
pow(
double
x, ExponentT p) {
111
return
std::pow(x,
double
(p));
112
}
113
115
inline
double
sqrt(
int
x) {
116
return
std::sqrt(
double
(x));
117
}
118
120
inline
constexpr
long
double
factorial
(
unsigned
int
n) {
121
return
(n < 2) ? 1.0 : n *
factorial
(n - 1);
122
}
123
125
template
<
typename
Container,
typename
Key>
126
inline
bool
member
(
const
Container & c,
const
Key & k) {
127
return
c.find(k) != c.end();
128
}
129
131
template
<
typename
T,
typename
Key>
132
inline
bool
member
(
const
vector<T> & v,
const
Key & k) {
133
for
(
typename
vector<T>::const_iterator i = v.begin(); i != v.end(); ++i )
134
if
( *i == k )
return
true
;
135
return
false
;
136
// return find(v.begin(), v.end(), k) != v.end();
137
}
138
140
template
<
typename
Cont>
141
inline
std::insert_iterator<Cont>
inserter
(Cont & c) {
142
return
std::insert_iterator<Cont>(c, c.end());
143
}
144
145
148
template
<
typename
T,
typename
A>
149
inline
std::back_insert_iterator< vector<T,A> >
inserter
(vector<T,A> & v) {
150
return
back_inserter(v);
151
}
152
155
template
<
typename
T,
typename
A>
156
inline
std::back_insert_iterator< deque<T,A> >
inserter
(deque<T,A> & v) {
157
return
back_inserter(v);
158
}
159
161
inline
ostream&
left
(ostream& os) {
162
os.setf(ios::left, ios::adjustfield);
163
return
os;
164
}
165
167
inline
ostream&
right
(ostream& os) {
168
os.setf(ios::right, ios::adjustfield);
169
return
os;
170
}
171
172
}
173
175
#define ThePEG_DECLARE_SET(VALTYPE,NAME) \
176
\
177
typedef set<VALTYPE, less<VALTYPE> > NAME
178
180
#define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \
181
\
182
typedef multiset<VALTYPE, less<VALTYPE> > NAME
183
185
#define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \
186
\
187
typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > NAME
188
189
#endif
/* ThePEG_std_H */
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::member
bool member(const Container &c, const Key &k)
Check if a given object is a part of a container.
Definition:
std.h:126
ThePEG::right
ostream & right(ostream &os)
Stream manipulator setting an ostream to right-adjust its ouput.
Definition:
std.h:167
ThePEG::inserter
std::insert_iterator< Cont > inserter(Cont &c)
Return an insert iterator for a given container.
Definition:
std.h:141
ThePEG::factorial
constexpr long double factorial(unsigned int n)
factorial
Definition:
std.h:120
ThePEG::left
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition:
std.h:161
std
STL namespace.
std::swap
void swap(ThePEG::Pointer::RCPtr< T > &t1, ThePEG::Pointer::RCPtr< T > &t2)
Specialization of std::swap to avoid unnecessary (in/de)crements of the reference count.
Definition:
RCPtr.h:1154
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6