Rivet: /Users/chrisg/software/rivet/include/Rivet/Tools/TypeTraits.hh Source File

| Rivet 3.1.9

TypeTraits.hh
1// -*- C++ -*-
2#ifndef RIVET_TypeTraits_HH
3#define RIVET_TypeTraits_HH
4
5#include <type_traits>
6
7namespace Rivet {
8
15
17
18 namespace SFINAE {
20 template <typename ...>
21 using void_t = void;
22 }
23
24
25 struct RefType { };
26
27 struct PtrType { };
28
29 template <typename T>
30 struct TypeTraits;
31
32 template <typename U>
33 struct TypeTraits<const U&> {
34 typedef RefType ArgType;
35 };
36
37 template <typename U>
38 struct TypeTraits<const U*> {
39 typedef PtrType ArgType;
40 };
41
42
43
45 template <typename T, typename=void>
46 struct Derefable : std::false_type {};
47 //
48 template <typename T>
49 struct Derefable<T, SFINAE::void_t< decltype(*std::declval<T>())> > : std::true_type {};
50
51
53 // template <typename T, typename=void>
54 // struct Iterable : std::false_type {};
55 // //
56 // template <typename T>
57 // struct Iterable<T, SFINAE::void_t< decltype(*std::declval<T>())> > : std::true_type {};
58 // template <typename T>
59 // using ConstIterable = pretty_print::is_container<T>;
60
61
62 template <typename T, typename=void>
63 struct HasXYZ : std::false_type {};
64 template <typename T>
65 struct HasXYZ<T, SFINAE::void_t< decltype(std::declval<T>().x() + std::declval<T>().y() + std::declval<T>().z())> > : std::true_type {};
66
67
68 template <typename T, typename=void>
69 struct HasXYZT : std::false_type {};
70 template <typename T>
71 struct HasXYZT<T, SFINAE::void_t< decltype(std::declval<T>().x() + std::declval<T>().y() + std::declval<T>().z() + std::declval<T>().t())> > : std::true_type {};
72
73
75
76}
77
78#endif
Rivet
Definition MC_Cent_pPb.hh:10
std
STL namespace.