-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathlength_lit.cpp
More file actions
51 lines (40 loc) · 1.45 KB
/
length_lit.cpp
File metadata and controls
51 lines (40 loc) · 1.45 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
// Футы в другие единицы
constexpr double operator"" _ft_to_in(long double feet) {
return static_cast<double>(feet * 12.0L);
}
constexpr double operator"" _ft_to_cm(long double feet) {
return static_cast<double>(feet * 30.48L);
}
constexpr double operator"" _ft_to_m(long double feet) {
return static_cast<double>(feet * 0.3048L);
}
// Дюймы в другие единицы
constexpr double operator"" _in_to_ft(long double inches) {
return static_cast<double>(inches / 12.0L);
}
constexpr double operator"" _in_to_cm(long double inches) {
return static_cast<double>(inches * 2.54L);
}
constexpr double operator"" _in_to_m(long double inches) {
return static_cast<double>(inches * 0.0254L);
}
// Сантиметры в другие единицы
constexpr double operator"" _cm_to_ft(long double cm) {
return static_cast<double>(cm / 30.48L);
}
constexpr double operator"" _cm_to_in(long double cm) {
return static_cast<double>(cm / 2.54L);
}
constexpr double operator"" _cm_to_m(long double cm) {
return static_cast<double>(cm / 100.0L);
}
// Метры в другие единицы
constexpr double operator"" _m_to_ft(long double meters) {
return static_cast<double>(meters / 0.3048L);
}
constexpr double operator"" _m_to_in(long double meters) {
return static_cast<double>(meters / 0.0254L);
}
constexpr double operator"" _m_to_cm(long double meters) {
return static_cast<double>(meters * 100.0L);
}