Answer the question
In order to leave comments, you need to log in
Enum forward declaration - how to get the base type?
There is a *.h file in which you need to make a forward declaration enum (not an enum class).
The first thing that comes to mind:
enum myEnum : int;
This works, but it's not entirely correct in cross-platform (Win 64 msvc, Linux 64 gcc) code to explicitly specify the data type explicitly (in the header that we forward, there is no way to specify the enum data type of the day, there is C ++ 03)
Therefore, the second, what comes to mind:
#include <type_traits>
enum enum_dummy { }
enum myEnum : std::underlying_type_t<enum_dummy>;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question