ZeroPhase
ZeroPhase

Reputation: 647

Explicit specialization in define causes error: explicit specialization in non-namespace scope

I'm getting explicit specialization in non-namespace scopeerror from this define:

#define DECLARE_INTERNAL_LINK_SPECIALIZATION(T, Counter) template<> struct T<Counter>

This is how the define is used, which triggers the error:

#define DECLARE_INTERNAL_LINK_BASE(T) template<int Counter> struct T
#define DECLARE_INTERNAL_LINK_SPECIALIZATION(T, Counter) template<> struct T<Counter>

namespace TestBugFix
{
    struct FPlatformTypeLayoutParameters
    {
        DECLARE_INTERNAL_LINK_BASE(InternalLinkType);
        DECLARE_INTERNAL_LINK_SPECIALIZATION(InternalLinkType, __COUNTER__);
    };
}

I believe I'm getting this as defines do not have namespace scope. This works fine for clang, but not GCC. How may I implement the same functionality within namespace scope?

Upvotes: 0

Views: 171

Answers (0)

Related Questions