thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Config
TemplateTools.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// TemplateTools.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 2006-2019 David Grellscheid, 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 Template_Tools_H
10
#define Template_Tools_H
11
12
#include <type_traits>
13
19
namespace
ThePEG
{
20
22
template
<
int
v>
23
struct
Int2Type
24
{
25
enum
{ value = v };
26
};
27
29
struct
DummyType
{};
30
34
enum
ImplSelector
{ Dimensioned, Standard, Enumerated };
35
37
typedef
Int2Type<Dimensioned>
DimensionT
;
38
40
typedef
Int2Type<Standard>
StandardT
;
41
43
typedef
Int2Type<Enumerated>
EnumT
;
44
45
47
template
<
typename
T>
48
struct
TypeTraits
49
{
51
enum
{ hasDimension =
false
};
53
typedef
StandardT
DimType
;
55
// construction with extra U type is necessary to make
56
// enable_if work before concepts are supported properly
57
template
<
typename
U = T>
58
static
constexpr
typename
59
std::enable_if< (std::is_arithmetic<U>::value &&
60
std::is_same<U, T>::value), U>::type
61
baseunit
()
62
{
return
static_cast<
U
>
(1); }
63
};
64
65
}
66
67
#endif
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::ImplSelector
ImplSelector
Selection mechanism for type-dependent implementations.
Definition:
TemplateTools.h:34
ThePEG::EnumT
Int2Type< Enumerated > EnumT
Typedef for non-dimensioned types.
Definition:
TemplateTools.h:43
ThePEG::DimensionT
Int2Type< Dimensioned > DimensionT
Typedef for dimensioned types.
Definition:
TemplateTools.h:37
ThePEG::StandardT
Int2Type< Standard > StandardT
Typedef for non-dimensioned types.
Definition:
TemplateTools.h:40
ThePEG::DummyType
Dummy type for ambiguous function signatures.
Definition:
TemplateTools.h:29
ThePEG::Int2Type
Conversion between integers and types.
Definition:
TemplateTools.h:24
ThePEG::TypeTraits
Type traits for built-in types.
Definition:
TemplateTools.h:49
ThePEG::TypeTraits::baseunit
static constexpr std::enable_if<(std::is_arithmetic< U >::value &&std::is_same< U, T >::value), U >::type baseunit()
Base unit for arithmetic types.
Definition:
TemplateTools.h:61
ThePEG::TypeTraits::DimType
StandardT DimType
Implementation selector.
Definition:
TemplateTools.h:53
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6