www.digitalmars.com         C & C++   DMDScript  

c++ - Failure to access enum in bolt-in's parameterising type

The following code gives

    boltinenum.cpp(25) : Error: 'sequence_type' must be a public base class of
'?$sequence_wrapper V?$sequence D  '

which is obviously a bit of a problem. ;)


    template <typename C>
    class sequence
    {
    public:
        enum
        {
            files   =   0x01
        };
    };

    template <typename S>
    class sequence_wrapper
    {
    public:
        typedef S   sequence_type;

    };

    int main()
    {
        typedef sequence<char>                  sequence_t;
        typedef sequence_wrapper<sequence_t>    wrapper_t;

        int f = wrapper_t::sequence_type::files;

        return f;
    }


I know there's a simple workaround - by typedef'ing to an intermediate type from
wrapper_t::sequence_type, and then accessing the enum value from there - but
this
is in highly-ported code, and it already contains more #ifdefs than the XP
source. ;(
May 22 2004