sandbox
Loading...
Searching...
No Matches
distance.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_UNITS_DISTANCE_HPP_
3#define LIBSBX_UNITS_DISTANCE_HPP_
4
5#include <libsbx/units/quantity.hpp>
6
7namespace sbx::units {
8
9namespace detail {
10
11struct distance_tag { };
12
13} // namespace detail
14
20
21namespace literals {
22
23inline constexpr auto operator""_km(long double value) -> kilometer {
24 return kilometer{static_cast<kilometer::value_type>(value)};
25}
26
27inline constexpr auto operator""_km(unsigned long long value) -> kilometer {
28 return kilometer{static_cast<kilometer::value_type>(value)};
29}
30
31inline constexpr auto operator""_m(long double value) -> meter {
32 return meter{static_cast<meter::value_type>(value)};
33}
34
35inline constexpr auto operator""_m(unsigned long long value) -> meter {
36 return meter{static_cast<meter::value_type>(value)};
37}
38
39inline constexpr auto operator""_dm(long double value) -> decimeter {
40 return decimeter{static_cast<decimeter::value_type>(value)};
41}
42
43inline constexpr auto operator""_dm(unsigned long long value) -> decimeter {
44 return decimeter{static_cast<decimeter::value_type>(value)};
45}
46
47inline constexpr auto operator""_cm(long double value) -> centimeter {
48 return centimeter{static_cast<centimeter::value_type>(value)};
49}
50
51inline constexpr auto operator""_cm(unsigned long long value) -> centimeter {
52 return centimeter{static_cast<centimeter::value_type>(value)};
53}
54
55inline constexpr auto operator""_mm(long double value) -> millimeter {
56 return millimeter{static_cast<millimeter::value_type>(value)};
57}
58
59inline constexpr auto operator""_mm(unsigned long long value) -> millimeter {
60 return millimeter{static_cast<millimeter::value_type>(value)};
61}
62
63} // namespace literals
64
65} // namespace sbx::units
66
67#endif // LIBSBX_UNITS_DISTANCE_HPP_
Definition: quantity.hpp:66
Definition: distance.hpp:11