-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathlength_lit.cpp
More file actions
51 lines (39 loc) · 1.28 KB
/
length_lit.cpp
File metadata and controls
51 lines (39 loc) · 1.28 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 long double METER_IN_FOOT = 0.3048;
constexpr long double INCH_IN_FOOT = 12;
constexpr long double METER_IN_INCH = 0.0254;
constexpr long double operator""_ft_to_m(long double foot) {
return foot * METER_IN_FOOT;
}
constexpr long double operator""_m_to_ft(long double meter) {
return meter / METER_IN_FOOT;
}
constexpr long double operator""_ft_to_cm(long double foot) {
return foot * METER_IN_FOOT * 100;
}
constexpr long double operator""_cm_to_ft(long double cm) {
return cm / (METER_IN_FOOT * 100);
}
constexpr long double operator""_ft_to_in(long double foot) {
return foot * INCH_IN_FOOT;
}
constexpr long double operator""_in_to_ft(long double inch) {
return inch / INCH_IN_FOOT;
}
constexpr long double operator""_in_to_m(long double inch) {
return inch * METER_IN_INCH;
}
constexpr long double operator""_m_to_in(long double meter) {
return meter / METER_IN_INCH;
}
constexpr long double operator""_in_to_cm(long double inch) {
return inch * METER_IN_INCH * 100;
}
constexpr long double operator""_cm_to_in(long double inch) {
return inch / (METER_IN_INCH * 100);
}
constexpr long double operator""_m_to_cm(long double meter) {
return meter * 100;
}
constexpr long double operator""_cm_to_m(long double cm) {
return cm / 100;
}