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.
Loading...
Searching...
No Matches
SI
astronomic.h
Go to the documentation of this file.
1
12
#pragma once
13
14
#include "
length.h
"
15
#include "
mass.h
"
16
17
namespace
SI
{
18
24
template
<
typename
_type>
25
using
astronomic_unit_t
=
length_t<_type, std::ratio<149597870691, 1>
>;
26
template
<
typename
_type>
27
using
lightyear_t
=
length_t<_type, std::ratio<9460730777119564, 1>
>;
28
template
<
typename
_type>
29
using
parsec_t
=
length_t<_type, std::ratio<30856775814913700, 1>
>;
30
31
inline
namespace
literals {
32
33
template
<
char
... _digits>
34
constexpr
astronomic_unit_t<int64_t>
operator
""
_AU() {
35
return
astronomic_unit_t<int64_t>
{
36
SI::detail::parsing::Number
<_digits...>::value};
37
}
38
39
template
<
char
... _digits>
constexpr
lightyear_t<int64_t>
operator
""
_ly() {
40
return
lightyear_t<int64_t>
{
SI::detail::parsing::Number
<_digits...>::value};
41
}
42
43
template
<
char
... _digits>
constexpr
parsec_t<int64_t>
operator
""
_pc() {
44
return
parsec_t<int64_t>
{
SI::detail::parsing::Number
<_digits...>::value};
45
}
46
47
constexpr
astronomic_unit_t<long double>
operator
""
_AU(
long
double
value) {
48
return
astronomic_unit_t<long double>
{value};
49
}
50
51
constexpr
lightyear_t<long double>
operator
""
_ly(
long
double
value) {
52
return
lightyear_t<long double>
{value};
53
}
54
55
constexpr
parsec_t<long double>
operator
""
_pc(
long
double
value) {
56
return
parsec_t<long double>
{value};
57
}
58
59
}
// namespace literals
60
61
}
// namespace SI
length.h
mass.h
SI
Definition
absorbed_dose.h:18
SI::detail::parsing::Number
interface class for number
Definition
number_parser.h:111
SI::detail::unit_t
base template class for holding values of type _type to be multiplied with a ratio _ratio
Definition
unit.h:51
Generated by
1.9.8