www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.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