-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathtime_scales.hpp
47 lines (37 loc) · 1.54 KB
/
time_scales.hpp
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
#pragma once
#include "geometry/named_quantities.hpp"
namespace principia {
namespace astronomy {
namespace internal_time_scales {
using geometry::Instant;
// NOTE(egg): We cannot use literal operator templates for strings, so if an
// invalid date is given and the result does not need to be constexpr the
// literal will fail at runtime; if proposal N3599 ever gets anywhere we'll be
// able to solve this.
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3599.html,
// http://wg21.cmeerw.net/ewg/issue66.
// FWIW it seems that clang supports this proposal with
// -Wno-gnu-string-literal-operator-template.
#if (PRINCIPIA_COMPILER_CLANG || PRINCIPIA_COMPILER_CLANG_CL) && WE_LIKE_N3599
template<typename C, C... str>
constexpr Instant operator""_TAI();
template<typename C, C... str>
constexpr Instant operator""_TT();
template<typename C, C... str>
constexpr Instant operator""_UTC();
template<typename C, C... str>
constexpr Instant operator""_UT1();
#else
constexpr Instant operator""_TAI(char const* str, std::size_t size);
constexpr Instant operator""_TT(char const* str, std::size_t size);
constexpr Instant operator""_UTC(char const* str, std::size_t size);
constexpr Instant operator""_UT1(char const* str, std::size_t size);
#endif
} // namespace internal_time_scales
using internal_time_scales::operator""_TAI;
using internal_time_scales::operator""_TT;
using internal_time_scales::operator""_UTC;
using internal_time_scales::operator""_UT1;
} // namespace astronomy
} // namespace principia
#include "astronomy/time_scales_body.hpp"