MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
calendars/mtcore_calendars/traits.hpp
Go to the documentation of this file.
1
/*
2
3
Copyright 2025 Matthew Tolman
4
5
Licensed under the Apache License, Version 2.0 (the "License");
6
you may not use this file except in compliance with the License.
7
You may obtain a copy of the License at
8
9
http://www.apache.org/licenses/LICENSE-2.0
10
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS,
13
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
See the License for the specific language governing permissions and
15
limitations under the License.
16
17
*/
18
19
#ifndef MTCORE_CALENDARS_TRAITS_HPP
20
#define MTCORE_CALENDARS_TRAITS_HPP
21
22
namespace
mtcore::calendars
{
23
struct
Fixed
;
24
struct
Moment
;
25
struct
UnixTimestamp;
26
27
template
<
typename
T>
28
concept
IsDayCalendarSystem
=
requires
(
const
T &t,
const
Fixed
&f) {
29
{ t.to_fixed() } -> std::same_as<Fixed>;
30
{ T::from_fixed(f) } -> std::same_as<T>;
31
{ T::EPOCH };
32
{ T::name };
33
{ t <=> t } -> std::same_as<std::strong_ordering>;
34
};
35
36
template
<
typename
T>
37
concept
IsTimeCalendarSystem
=
requires
(
const
T &t,
const
Moment
&f) {
38
{ t.to_moment() } -> std::same_as<Moment>;
39
{ T::from_moment(f) } -> std::same_as<T>;
40
{ T::EPOCH };
41
{ T::name };
42
{ t <=> t } -> std::same_as<std::partial_ordering>;
43
};
44
}
// namespace mtcore::calendars
45
46
#endif
// MTCORE_CALENDARS_TRAITS_HPP
mtcore::calendars::IsDayCalendarSystem
Definition
calendars/mtcore_calendars/traits.hpp:28
mtcore::calendars::IsTimeCalendarSystem
Definition
calendars/mtcore_calendars/traits.hpp:37
mtcore::calendars
Namespace for calendaring systems.
Definition
calendars/mtcore_calendars/core.hpp:27
mtcore::calendars::Fixed
Base calendar system tracking the number of days since its epoch.
Definition
fixed.hpp:42
mtcore::calendars::Moment
Base calendar system tracking the number of days (and fraction of days) since its epoch.
Definition
fixed.hpp:264
include
calendars
mtcore_calendars
traits.hpp
Generated on Wed Jun 11 2025 16:30:22 for MT Core (C++) by
1.13.2