abienum 0.0.0-2025-01-19

underlying types for C enums
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This file is used by build.rs to verify the underlying type of an enum, when
// left implicit, is the expected type given a minimum and maximum value.

#include <type_traits>

enum test_enum {
    min = TEST_ENUM_MIN,
    max = TEST_ENUM_MAX,
};

static_assert(
    std::is_same<
        TEST_ENUM_TYPE,
        std::underlying_type<test_enum>::type
    >::value,
    "test_enum didn't match expected type"
);