VCCC  2024.05
VisualCamp Common C++ library
to_underlying.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2024/01/02.
3 //
4 
5 #ifndef VCCC_UTILITY_TO_UNDERLYING_HPP
6 #define VCCC_UTILITY_TO_UNDERLYING_HPP
7 
8 #include <type_traits>
9 
10 namespace vccc {
11 
14 
15 
22 template<typename Enum>
23 constexpr std::underlying_type_t<Enum>& as_const(Enum e) noexcept {
24  return static_cast<std::underlying_type_t<Enum>>(e);
25 }
26 
28 
29 } // namespace vccc
30 
31 #endif // VCCC_UTILITY_TO_UNDERLYING_HPP
constexpr T e
the mathematical constant
Definition: constants.hpp:37
constexpr std::add_const_t< T > & as_const(T &t) noexcept
obtains a reference to const to its argument
Definition: as_const.hpp:23
Definition: directory.h:12