thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.2.1
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 *> :
51
public
binary_function<const type_info *, const type_info *, bool>
52
{
57
bool
operator()(
const
type_info * x,
const
type_info * y)
const
{
58
return
x->before(*y); }
59
};
62
}
63
64
namespace
ThePEG
{
65
66
using
std::array;
67
using
std::deque;
68
using
std::stack;
69
using
std::vector;
70
using
std::multiset;
71
using
std::set;
72
using
std::map;
73
using
std::list;
74
using
std::multimap;
75
using
std::pair;
76
using
std::make_pair;
77
using
std::less;
78
using
std::string;
79
using
std::type_info;
80
using
std::exception;
81
using
std::range_error;
82
using
std::ios;
83
using
std::ostream;
84
using
std::istream;
85
using
std::ofstream;
86
using
std::ifstream;
87
using
std::ostringstream;
88
using
std::istringstream;
89
using
std::cin;
90
using
std::cout;
91
using
std::cerr;
92
using
std::endl;
93
using
std::flush;
94
using
std::setprecision;
95
using
std::setw;
96
using
std::swap;
97
using
std::min;
98
using
std::max;
99
using
std::mem_fn;
100
using
std::mem_fun;
101
using
std::sqrt
;
102
//using std::pow;
103
using
std::abs;
104
using
std::atan2;
105
using
std::isfinite;
106
108
template
<
class
ExponentT>
109
inline
constexpr
double
pow
(
double
x, ExponentT p) {
110
return
std::pow
(x,
double
(p));
111
}
112
114
inline
double
sqrt
(
int
x) {
115
return
std::sqrt
(
double
(x));
116
}
117
119
inline
constexpr
long
double
factorial
(
unsigned
int
n) {
120
return
(n < 2) ? 1.0 : n *
factorial
(n - 1);
121
}
122
124
template
<
typename
Container,
typename
Key>
125
inline
bool
member
(
const
Container & c,
const
Key & k) {
126
return
c.find(k) != c.end();
127
}
128
130
template
<
typename
T,
typename
Key>
131
inline
bool
member
(
const
vector<T> & v,
const
Key & k) {
132
for
(
typename
vector<T>::const_iterator i = v.begin(); i != v.end(); ++i )
133
if
( *i == k )
return
true
;
134
return
false
;
135
// return find(v.begin(), v.end(), k) != v.end();
136
}
137
139
template
<
typename
Cont>
140
inline
std::insert_iterator<Cont>
inserter
(Cont & c) {
141
return
std::insert_iterator<Cont>(c, c.end());
142
}
143
144
147
template
<
typename
T,
typename
A>
148
inline
std::back_insert_iterator< vector<T,A> >
inserter
(vector<T,A> & v) {
149
return
back_inserter(v);
150
}
151
154
template
<
typename
T,
typename
A>
155
inline
std::back_insert_iterator< deque<T,A> >
inserter
(deque<T,A> & v) {
156
return
back_inserter(v);
157
}
158
160
inline
ostream&
left
(ostream& os) {
161
os.setf(
ios::left
, ios::adjustfield);
162
return
os;
163
}
164
166
inline
ostream&
right
(ostream& os) {
167
os.setf(
ios::right
, ios::adjustfield);
168
return
os;
169
}
170
171
}
172
174
#define ThePEG_DECLARE_SET(VALTYPE,NAME) \
175
\
176
typedef set<VALTYPE, less<VALTYPE> > NAME
177
179
#define ThePEG_DECLARE_MULTISET(VALTYPE,NAME) \
180
\
181
typedef multiset<VALTYPE, less<VALTYPE> > NAME
182
184
#define ThePEG_DECLARE_MAP(KEYTYPE,VALTYPE,NAME) \
185
\
186
typedef map<KEYTYPE, VALTYPE, less<KEYTYPE> > NAME
187
188
#endif
/* ThePEG_std_H */
ThePEG::sqrt
double sqrt(int x)
Square root of an integer.
Definition:
std.h:114
ThePEG::pow
constexpr double pow(double x, ExponentT p)
Powers - standard or non-standard.
Definition:
std.h:109
ThePEG::member
bool member(const vector< T > &v, const Key &k)
Check if a given object is a part of a vector.
Definition:
std.h:131
std
STL namespace.
ThePEG::inserter
std::back_insert_iterator< deque< T, A > > inserter(deque< T, A > &v)
Return an insert iterator for a given vector.
Definition:
std.h:155
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::left
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition:
std.h:160
ThePEG::right
ostream & right(ostream &os)
Stream manipulator setting an ostream to right-adjust its ouput.
Definition:
std.h:166
ThePEG::factorial
constexpr long double factorial(unsigned int n)
factorial
Definition:
std.h:119
Generated on Sat Apr 11 2020 14:31:18 for ThePEG by
1.8.13