ThePEG
1.8.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Utilities
Triplet.h
1
// -*- C++ -*-
2
//
3
// Triplet.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2011 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_Triplet_H
10
#define ThePEG_Triplet_H
11
12
#include "ThePEG/Config/ThePEG.h"
13
14
namespace
ThePEG {
15
20
template
<
typename
T1,
typename
T2,
typename
T3>
21
struct
Triplet
{
22
24
typedef
T1
first_type
;
26
typedef
T2
second_type
;
28
typedef
T3
third_type
;
29
31
T1
first
;
33
T2
second
;
35
T3
third
;
36
38
Triplet
() :
first
(T1()),
second
(T2()),
third
(T3()) {}
39
41
Triplet
(
const
T1 & t1,
const
T2 & t2,
const
T3 & t3)
42
:
first
(t1),
second
(t2),
third
(t3) {}
43
45
Triplet
(
const
Triplet<T1,T2,T3>
& t)
46
:
first
(t.
first
),
second
(t.
second
),
third
(t.
third
) {}
47
49
template
<
typename
U1,
typename
U2,
typename
U3>
50
Triplet
(
const
Triplet<U1,U2,U3>
& u)
51
:
first
(u.
first
),
second
(u.
second
),
third
(u.
third
) {}
52
54
bool
operator==
(
const
Triplet<T1,T2,T3>
& t)
const
{
55
return
first
== t.
first
&&
second
== t.
second
&&
third
== t.
third
;
56
}
57
62
bool
operator<(const Triplet<T1,T2,T3> & t)
const
{
63
return
first
< t.first ||
64
( !(t.first <
first
) &&
65
(
second
< t.second ||
66
( !(t.second <
second
) &&
third
< t.third )));
67
}
68
};
69
72
template
<
typename
T1,
typename
T2,
typename
T3>
73
inline
Triplet<T1,T2,T3>
74
makeTriplet
(
const
T1 & t1,
const
T2 & t2,
const
T3 & t3)
75
{
76
return
Triplet<T1,T2,T3>
(t1, t2, t3);
77
}
78
80
template
<
typename
OStream,
typename
T1,
typename
T2,
typename
T3>
81
OStream & operator<<(OStream & os, const Triplet<T1,T2,T3> & t) {
82
return
os << t.first << t.second << t.third;
83
}
84
86
template
<
typename
IStream,
typename
T1,
typename
T2,
typename
T3>
87
IStream &
operator>>
(IStream & is,
Triplet<T1,T2,T3>
& t) {
88
return
is >> t.
first
>> t.
second
>> t.
third
;
89
}
90
91
}
92
93
#endif
/* ThePEG_Triplet_H */
Generated on Mon Jul 2 2012 16:06:48 for ThePEG by
1.8.1.1