Resolve clashing global and nested namespace names

Using better_enums as a nested namespace name along a global better_enums namespace resulted in name clashes.
This commit is contained in:
cheparukhin 2016-06-22 15:52:35 +01:00 committed by GitHub
parent 9e522eaf3c
commit d94b21a7e0

10
enum.h
View File

@ -555,7 +555,7 @@ constexpr const char *_final_ ## index = \
// The enums proper. // The enums proper.
#define BETTER_ENUMS_NS(EnumType) better_enums::_data_ ## EnumType #define BETTER_ENUMS_NS(EnumType) better_enums_data_ ## EnumType
#ifdef BETTER_ENUMS_VC2008_WORKAROUNDS #ifdef BETTER_ENUMS_VC2008_WORKAROUNDS
@ -574,12 +574,10 @@ constexpr const char *_final_ ## index = \
DeclareInitialize, DefineInitialize, CallInitialize, \ DeclareInitialize, DefineInitialize, CallInitialize, \
Enum, Underlying, ...) \ Enum, Underlying, ...) \
\ \
namespace better_enums { \ namespace better_enums_data_ ## Enum { \
namespace _data_ ## Enum { \
\ \
BETTER_ENUMS_ID(GenerateSwitchType(Underlying, __VA_ARGS__)) \ BETTER_ENUMS_ID(GenerateSwitchType(Underlying, __VA_ARGS__)) \
\ \
} \
} \ } \
\ \
class Enum { \ class Enum { \
@ -662,8 +660,7 @@ class Enum { \
friend struct ::better_enums::_initialize_at_program_start<Enum>; \ friend struct ::better_enums::_initialize_at_program_start<Enum>; \
}; \ }; \
\ \
namespace better_enums { \ namespace better_enums_data_ ## Enum { \
namespace _data_ ## Enum { \
\ \
static ::better_enums::_initialize_at_program_start<Enum> \ static ::better_enums::_initialize_at_program_start<Enum> \
_force_initialization; \ _force_initialization; \
@ -675,7 +672,6 @@ BETTER_ENUMS_CONSTEXPR_ const Enum _value_array[] = \
\ \
BETTER_ENUMS_ID(GenerateStrings(Enum, __VA_ARGS__)) \ BETTER_ENUMS_ID(GenerateStrings(Enum, __VA_ARGS__)) \
\ \
} \
} \ } \
\ \
BETTER_ENUMS_CONSTEXPR_ inline const Enum \ BETTER_ENUMS_CONSTEXPR_ inline const Enum \