BibleTime
to_underlying.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2026 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <utility>
16
17
18namespace util {
19
20#if defined(__cpp_lib_to_underlying) && (__cpp_lib_to_underlying >= 202102L)
21template <typename ... Args>
22constexpr auto to_underlying(Args && ... args)
23{ return std::to_underlying(std::forward<Args>(args)...); }
24#else
25template <typename T>
26[[nodiscard]] constexpr std::underlying_type_t<T>
27to_underlying(T value) noexcept
28{ return static_cast<std::underlying_type_t<T>>(value); }
29#endif
30
31} // namespace util
#define T(f)
constexpr std::underlying_type_t< T > to_underlying(T value) noexcept