tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
duration_values.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_CHRONO_DURATION_VALUES_HPP
5#define TETL_CHRONO_DURATION_VALUES_HPP
6
7#include <etl/_limits/numeric_limits.hpp>
8
9namespace etl::chrono {
10
11/// The etl::chrono::duration_values type defines three common durations.
12///
13/// The zero, min, and max methods in etl::chrono::duration forward
14/// their work to these methods. This type can be specialized if the
15/// representation Rep requires a specific implementation to return these
16/// duration objects.
17///
18/// \ingroup chrono
19template <typename Rep>
21public:
22 /// \brief Returns a zero-length representation.
23 [[nodiscard]] static constexpr auto zero() -> Rep
24 {
25 return Rep{};
26 }
27
28 /// \brief Returns the smallest possible representation.
29 [[nodiscard]] static constexpr auto min() -> Rep
30 {
31 return etl::numeric_limits<Rep>::lowest();
32 }
33
34 /// \brief Returns the special duration value max.
35 [[nodiscard]] static constexpr auto max() -> Rep
36 {
37 return etl::numeric_limits<Rep>::max();
38 }
39};
40
41} // namespace etl::chrono
42
43#endif // TETL_CHRONO_DURATION_VALUES_HPP
Definition abs.hpp:12
Definition adjacent_find.hpp:9
The etl::chrono::duration_values type defines three common durations.
Definition duration_values.hpp:20
static constexpr auto max() -> Rep
Returns the special duration value max.
Definition duration_values.hpp:35
static constexpr auto min() -> Rep
Returns the smallest possible representation.
Definition duration_values.hpp:29
static constexpr auto zero() -> Rep
Returns a zero-length representation.
Definition duration_values.hpp:23
Definition numeric_limits.hpp:18