-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathlength_lit.cpp
More file actions
67 lines (53 loc) · 1.66 KB
/
length_lit.cpp
File metadata and controls
67 lines (53 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <string>
// Константы для преобразования
constexpr long double IN_TO_CM = 2.54L;
constexpr long double FT_TO_IN = 12.0L;
constexpr long double M_TO_CM = 100.0L;
// ft -> in
double operator"" _ft_to_in(long double ft_value) {
return static_cast<double>(ft_value * FT_TO_IN);
}
// ft -> cm
double operator"" _ft_to_cm(long double ft_value) {
return static_cast<double>(ft_value * FT_TO_IN * IN_TO_CM);
}
// ft -> m
double operator"" _ft_to_m(long double ft_value) {
return static_cast<double>(ft_value * FT_TO_IN * IN_TO_CM / M_TO_CM);
}
// in -> ft
double operator"" _in_to_ft(long double in_value) {
return static_cast<double>(in_value / FT_TO_IN);
}
// in -> cm
double operator"" _in_to_cm(long double in_value) {
return static_cast<double>(in_value * IN_TO_CM);
}
// in -> m
double operator"" _in_to_m(long double in_value) {
return static_cast<double>(in_value * IN_TO_CM / M_TO_CM);
}
// cm -> ft
double operator"" _cm_to_ft(long double cm_value) {
return static_cast<double>(cm_value / IN_TO_CM / FT_TO_IN);
}
// cm -> in
double operator"" _cm_to_in(long double cm_value) {
return static_cast<double>(cm_value / IN_TO_CM);
}
// cm -> m
double operator"" _cm_to_m(long double cm_value) {
return static_cast<double>(cm_value / M_TO_CM);
}
// m -> ft
double operator"" _m_to_ft(long double m_value) {
return static_cast<double>(m_value * M_TO_CM / IN_TO_CM / FT_TO_IN);
}
// m -> in
double operator"" _m_to_in(long double m_value) {
return static_cast<double>(m_value * M_TO_CM / IN_TO_CM);
}
// m -> cm
double operator"" _m_to_cm(long double m_value) {
return static_cast<double>(m_value * M_TO_CM);
}