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.
area.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "length.h"
15 
16 namespace SI {
17 template <typename _type, typename _ratio>
18 using area_t = detail::unit_t<'L', std::ratio<2>, _type, _ratio>;
19 
20 template <typename _type> using square_metre_t = area_t<_type, std::ratio<1>>;
21 template <typename _type>
24 
25 template <typename _type>
28 
29 template <typename _type, typename _ratio>
31 
32 template <typename _type> using cubic_metre_t = volume_t<_type, std::ratio<1>>;
33 template <typename _type>
35 template <typename _type>
37 
38 // specialized unit_symbol for usage with stream operators
39 template <>
40 struct unit_symbol<'L', std::ratio<1>, std::ratio<2>>
41  : SI::detail::unit_symbol_impl<'m', '2'> {};
42 
43 template <>
44 struct unit_symbol<'L', std::ratio<1, 10000>, std::ratio<2>>
45  : SI::detail::unit_symbol_impl<'c', 'm', '2'> {};
46 
47 template <>
48 struct unit_symbol<'L', std::micro, std::ratio<2>>
49  : SI::detail::unit_symbol_impl<'m', 'm', '2'> {};
50 
51 template <>
52 struct unit_symbol<'L', std::ratio<1>, std::ratio<3>>
53  : SI::detail::unit_symbol_impl<'m', '3'> {};
54 
55 template <>
56 struct unit_symbol<'L', std::ratio<1, 1000000>, std::ratio<3>>
57  : SI::detail::unit_symbol_impl<'c', 'm', '3'> {};
58 
59 template <>
60 struct unit_symbol<'L', std::nano, std::ratio<3>>
61  : SI::detail::unit_symbol_impl<'m', 'm', '3'> {};
62 
63 inline namespace literals {
64 template <char... _digits> constexpr square_metre_t<int64_t> operator""_m2() {
66  SI::detail::parsing::Number<_digits...>::value};
67 }
68 
69 constexpr square_metre_t<long double> operator"" _m2(long double m) {
71 }
72 
73 template <char... _digits>
74 constexpr square_centi_metre_t<int64_t> operator""_cm2() {
76  SI::detail::parsing::Number<_digits...>::value};
77 }
78 
79 constexpr square_centi_metre_t<long double> operator"" _cm2(long double cm) {
81 }
82 
83 template <char... _digits>
84 constexpr square_milli_metre_t<int64_t> operator""_mm2() {
86  SI::detail::parsing::Number<_digits...>::value};
87 }
88 
89 constexpr square_milli_metre_t<long double> operator"" _mm2(long double mm) {
91 }
92 
93 template <char... _digits> constexpr cubic_metre_t<int64_t> operator""_m3() {
94  return cubic_metre_t<int64_t>{SI::detail::parsing::Number<_digits...>::value};
95 }
96 
97 constexpr cubic_metre_t<long double> operator"" _m3(long double m) {
99 }
100 
101 template <char... _digits>
102 constexpr cubic_centi_metre_t<int64_t> operator""_cm3() {
104  SI::detail::parsing::Number<_digits...>::value};
105 }
106 
107 constexpr cubic_centi_metre_t<long double> operator"" _cm3(long double cm) {
109 }
110 
111 template <char... _digits>
112 constexpr cubic_milli_metre_t<int64_t> operator""_mm3() {
114  SI::detail::parsing::Number<_digits...>::value};
115 }
116 
117 constexpr cubic_milli_metre_t<long double> operator"" _mm3(long double mm) {
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