emlabcpp
modern opinionated embedded C++ library
enum.h
Go to the documentation of this file.
1
24
#pragma once
25
26
#ifdef EMLABCPP_USE_MAGIC_ENUM
27
28
#include <magic_enum/magic_enum.hpp>
29
30
#endif
31
32
#include <type_traits>
33
34
namespace
emlabcpp
35
{
36
38
template
<
typename
Enum >
39
requires
( std::is_enum_v< Enum > )
40
auto
convert_enum( Enum val )
41
{
42
#ifdef EMLABCPP_USE_MAGIC_ENUM
43
return
magic_enum::enum_name( val );
44
#else
45
return
std::to_string(
static_cast<
std::underlying_type_t< Enum >
>
( val ) );
46
#endif
47
}
48
49
}
// namespace emlabcpp
emlabcpp
MIT License.
Definition:
impl.h:31
emlabcpp::requires
requires(!range_container< Container >) const expr std
Returns index of an element in tuple 't', for which call to predicate f(x) holds true,...
Definition:
algorithm.h:127
include
emlabcpp
enum.h
Generated on Sun Jul 27 2025 20:01:11 for emlabcpp by
1.9.1