埃博拉酱
埃博拉酱

Reputation: 325

How can I properly using this struct template nested in a struct template?

enum ByteOrder_e
{
    MM,
    II,
};
template<ByteOrder_e O>
struct ByteOrder_s
{
    enum Version_e
    {
        Small,
        Big
    };
    template<Version_e V>
    struct Version_s
    {
    };
};
template<ByteOrder_e O, typename ByteOrder_s<O>::Version_e V>
void Open()
{
    using Version = typename ByteOrder_s<O>::Version_s<V>; //MSVC considers this line to be wrong
}

ConsoleApplication1.cpp(22,52): error C2760: syntax error: '<' was unexpected here; expected ';' ConsoleApplication1.cpp(22,55): error C2760: syntax error: ';' was unexpected here; expected 'expression'

Upvotes: 0

Views: 48

Answers (1)

康桓瑋
康桓瑋

Reputation: 42736

Indicates that Version_s is a class template by introducing the template keyword:

using Version = typename ByteOrder_s<O>::template Version_s<V>;
//                                     ^^^^^^^^^^

Upvotes: 1

Related Questions