thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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
19namespace ThePEG {
20
22template <int v>
24{
25 enum { value = v };
26};
27
29struct DummyType {};
30
34enum ImplSelector { Dimensioned, Standard, Enumerated };
35
38
41
44
45
47template <typename T>
49{
51 enum { hasDimension = false };
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
62 { return static_cast<U>(1); }
63};
64
65}
66
67#endif
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
ImplSelector
Selection mechanism for type-dependent implementations.
Definition: TemplateTools.h:34
Int2Type< Enumerated > EnumT
Typedef for non-dimensioned types.
Definition: TemplateTools.h:43
Int2Type< Dimensioned > DimensionT
Typedef for dimensioned types.
Definition: TemplateTools.h:37
Int2Type< Standard > StandardT
Typedef for non-dimensioned types.
Definition: TemplateTools.h:40
Dummy type for ambiguous function signatures.
Definition: TemplateTools.h:29
Conversion between integers and types.
Definition: TemplateTools.h:24
Type traits for built-in types.
Definition: TemplateTools.h:49
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
StandardT DimType
Implementation selector.
Definition: TemplateTools.h:53