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.
solid_angle.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "detail/number_parser.h"
15 #include "detail/unit.h"
16 #include "detail/unit_symbol.h"
17 
18 namespace SI {
19 
20 template <typename _type, typename _ratio>
22 
23 template <typename _type>
25 template <typename _type>
27 template <typename _type>
29 template <typename _type>
31 template <typename _type>
33 template <typename _type>
35 template <typename _type>
37 
38 // specialize unit_symbol for usage with stream operators
39 template <>
40 struct unit_symbol<'R', std::ratio<1>>
41  : SI::detail::unit_symbol_impl<'s', 'r'> {};
42 
43 template <typename _ratio>
44 struct unit_symbol<'R', _ratio>
45  : SI::detail::unit_symbol_impl<SI::detail::ratio_prefix<_ratio>::value, 's',
46  'r'> {
47  static_assert(std::ratio_less_equal<_ratio, std::ratio<1>>::value,
48  "Values with ratio > 1/1 not implemented");
49 };
50 
51 inline namespace literals {
52 
53 template <char... _digits>
54 constexpr atto_steradian_t<int64_t> operator""_asr() {
56  SI::detail::parsing::Number<_digits...>::value};
57 }
58 
59 template <char... _digits>
60 constexpr femto_steradian_t<int64_t> operator""_fsr() {
62  SI::detail::parsing::Number<_digits...>::value};
63 }
64 
65 template <char... _digits>
66 constexpr pico_steradian_t<int64_t> operator""_psr() {
68  SI::detail::parsing::Number<_digits...>::value};
69 }
70 
71 template <char... _digits>
72 constexpr nano_steradian_t<int64_t> operator""_nsr() {
74  SI::detail::parsing::Number<_digits...>::value};
75 }
76 
77 template <char... _digits>
78 constexpr micro_steradian_t<int64_t> operator""_usr() {
80  SI::detail::parsing::Number<_digits...>::value};
81 }
82 
83 template <char... _digits>
84 constexpr milli_steradian_t<int64_t> operator""_msr() {
86  SI::detail::parsing::Number<_digits...>::value};
87 }
88 
89 template <char... _digits> constexpr steradian_t<int64_t> operator""_sr() {
90  return steradian_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
91 }
92 
93 constexpr atto_steradian_t<long double> operator""_asr(long double value) {
94  return atto_steradian_t<long double>{value};
95 }
96 
97 constexpr femto_steradian_t<long double> operator""_fsr(long double value) {
98  return femto_steradian_t<long double>{value};
99 }
100 
101 constexpr pico_steradian_t<long double> operator""_psr(long double value) {
102  return pico_steradian_t<long double>{value};
103 }
104 
105 constexpr nano_steradian_t<long double> operator""_nsr(long double value) {
106  return nano_steradian_t<long double>{value};
107 }
108 
109 constexpr micro_steradian_t<long double> operator""_usr(long double value) {
110  return micro_steradian_t<long double>{value};
111 }
112 
113 constexpr milli_steradian_t<long double> operator""_msr(long double value) {
114  return milli_steradian_t<long double>{value};
115 }
116 
117 constexpr steradian_t<long double> operator""_sr(long double value) {
118  return steradian_t<long double>{value};
119 }
120 
121 } // namespace literals
122 
123 } // 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