SI  2.5.4
A header only c++ library that provides type safety and user defined literals for handling physical values defined in the International System of Units.
temperature.h
Go to the documentation of this file.
1 
12 #pragma once
13 #include "detail/number_parser.h"
14 #include "detail/unit.h"
15 #include "detail/unit_symbol.h"
16 
17 namespace SI {
18 
21 template <typename _type, typename _ratio>
23 template <typename _type> using atto_kelvin_t = temperature_t<_type, std::atto>;
24 template <typename _type>
26 template <typename _type> using pico_kelvin_t = temperature_t<_type, std::pico>;
27 template <typename _type> using nano_kelvin_t = temperature_t<_type, std::nano>;
28 template <typename _type>
30 template <typename _type>
32 template <typename _type> using kelvin_t = temperature_t<_type, std::ratio<1>>;
33 template <typename _type> using kilo_kelvin_t = temperature_t<_type, std::kilo>;
34 template <typename _type> using mega_kelvin_t = temperature_t<_type, std::mega>;
35 template <typename _type> using giga_kelvin_t = temperature_t<_type, std::giga>;
36 template <typename _type> using tera_kelvin_t = temperature_t<_type, std::tera>;
37 template <typename _type> using peta_kelvin_t = temperature_t<_type, std::peta>;
38 template <typename _type> using exa_kelvin_t = temperature_t<_type, std::exa>;
39 
40 // specialize unit_symbol for usage with stream operators
41 template <>
42 struct unit_symbol<'t', std::ratio<1>> : SI::detail::unit_symbol_impl<'K'> {};
43 
44 template <typename _ratio>
45 struct unit_symbol<'t', _ratio>
46  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value,
47  'K'> {};
48 
49 inline namespace literals {
50 
51 template <char... _digits> constexpr atto_kelvin_t<int64_t> operator""_aK() {
52  return atto_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
53 }
54 
55 template <char... _digits> constexpr femto_kelvin_t<int64_t> operator""_fK() {
57  SI::detail::parsing::Number<_digits...>::value};
58 }
59 
60 template <char... _digits> constexpr pico_kelvin_t<int64_t> operator""_pK() {
61  return pico_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
62 }
63 
64 template <char... _digits> constexpr nano_kelvin_t<int64_t> operator""_nK() {
65  return nano_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
66 }
67 
68 template <char... _digits> constexpr micro_kelvin_t<int64_t> operator""_uK() {
70  SI::detail::parsing::Number<_digits...>::value};
71 }
72 
73 template <char... _digits> constexpr milli_kelvin_t<int64_t> operator""_mK() {
75  SI::detail::parsing::Number<_digits...>::value};
76 }
77 
78 template <char... _digits> constexpr kelvin_t<int64_t> operator""_K() {
79  return kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
80 }
81 
82 template <char... _digits> constexpr kilo_kelvin_t<int64_t> operator""_kK() {
83  return kilo_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
84 }
85 
86 template <char... _digits> constexpr mega_kelvin_t<int64_t> operator""_MK() {
87  return mega_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
88 }
89 
90 template <char... _digits> constexpr giga_kelvin_t<int64_t> operator""_GK() {
91  return giga_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
92 }
93 
94 template <char... _digits> constexpr tera_kelvin_t<int64_t> operator""_TK() {
95  return tera_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
96 }
97 
98 template <char... _digits> constexpr peta_kelvin_t<int64_t> operator""_PK() {
99  return peta_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
100 }
101 
102 template <char... _digits> constexpr exa_kelvin_t<int64_t> operator""_EK() {
103  return exa_kelvin_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
104 }
105 
106 constexpr atto_kelvin_t<long double> operator""_aK(long double value) {
107  return atto_kelvin_t<long double>{value};
108 }
109 
110 constexpr femto_kelvin_t<long double> operator""_fK(long double value) {
111  return femto_kelvin_t<long double>{value};
112 }
113 
114 constexpr pico_kelvin_t<long double> operator""_pK(long double value) {
115  return pico_kelvin_t<long double>{value};
116 }
117 
118 constexpr nano_kelvin_t<long double> operator""_nK(long double value) {
119  return nano_kelvin_t<long double>{value};
120 }
121 
122 constexpr micro_kelvin_t<long double> operator""_uK(long double value) {
123  return micro_kelvin_t<long double>{value};
124 }
125 
126 constexpr milli_kelvin_t<long double> operator""_mK(long double value) {
127  return milli_kelvin_t<long double>{value};
128 }
129 
130 constexpr kelvin_t<long double> operator""_K(long double value) {
131  return kelvin_t<long double>{value};
132 }
133 
134 constexpr kilo_kelvin_t<long double> operator""_kK(long double value) {
135  return kilo_kelvin_t<long double>{value};
136 }
137 
138 constexpr mega_kelvin_t<long double> operator""_MK(long double value) {
139  return mega_kelvin_t<long double>{value};
140 }
141 
142 constexpr giga_kelvin_t<long double> operator""_GK(long double value) {
143  return giga_kelvin_t<long double>{value};
144 }
145 
146 constexpr tera_kelvin_t<long double> operator""_TK(long double value) {
147  return tera_kelvin_t<long double>{value};
148 }
149 
150 constexpr peta_kelvin_t<long double> operator""_PK(long double value) {
151  return peta_kelvin_t<long double>{value};
152 }
153 
154 constexpr exa_kelvin_t<long double> operator""_EK(long double value) {
155  return exa_kelvin_t<long double>{value};
156 }
157 
158 } // namespace literals
159 } // namespace SI
Definition: absorbed_dose.h:18
interface class for number
Definition: number_parser.h:111
Compile time string provider for conversion of unit types to strings.
Definition: unit_symbol.h:21
base template class for holding values of type _type to be multiplied with a ratio _ratio
Definition: unit.h:51
Base struct. Unusable needs template overloading.
Definition: unit_symbol.h:64