T
Thomas Barnet-Lamb
I was wondering if anyone could give me some help with the following.
Consider the code snippet:
struct qqq{typedef qqq* pointer;};
template<class al> struct foo : public al
{
template <class T> struct rebind
{
typedef foo<qqq> other;
};
};
int main()
{
typedef foo<qqq >::rebind<qqq>:ther alloc_typ;
typedef alloc_typ::rebind<qqq>:ther:ointer pppp;
return 0;
}
Is there any reason that this code should not compile? MS VC .NET 2003
gives error message:
c:\Documents and Settings\tblamb\My Documents\Visual Studio
Projects\test0\test0\test0.cpp(20) : error C2248:
'foo<al>::rebind<T>:ther' : cannot access inaccessible typedef
declared in class 'foo<al>'
with
[
al=qqq,
T=qqq
]
and
[
al=qqq
]
.... etc.
Unfortunately, I cannot see why the typedef ought to be inaccessible.
(Indeed, the error message itself is a little strange, since normally
the compiler gives messages like "cannot access private typedef" or
"cannot access protected typedef", which explain why the symbol is
inaccessible, rather than just "cannot access inaccessible typedef".)
The www.comeaucomputing.com compiler accepted the code. I have not
tested it with g++.
Thanks for any help!
Thomas Barnet-Lamb
Programmer, Lionhead Studios Ltd.
www.lionhead.com
Consider the code snippet:
struct qqq{typedef qqq* pointer;};
template<class al> struct foo : public al
{
template <class T> struct rebind
{
typedef foo<qqq> other;
};
};
int main()
{
typedef foo<qqq >::rebind<qqq>:ther alloc_typ;
typedef alloc_typ::rebind<qqq>:ther:ointer pppp;
return 0;
}
Is there any reason that this code should not compile? MS VC .NET 2003
gives error message:
c:\Documents and Settings\tblamb\My Documents\Visual Studio
Projects\test0\test0\test0.cpp(20) : error C2248:
'foo<al>::rebind<T>:ther' : cannot access inaccessible typedef
declared in class 'foo<al>'
with
[
al=qqq,
T=qqq
]
and
[
al=qqq
]
.... etc.
Unfortunately, I cannot see why the typedef ought to be inaccessible.
(Indeed, the error message itself is a little strange, since normally
the compiler gives messages like "cannot access private typedef" or
"cannot access protected typedef", which explain why the symbol is
inaccessible, rather than just "cannot access inaccessible typedef".)
The www.comeaucomputing.com compiler accepted the code. I have not
tested it with g++.
Thanks for any help!
Thomas Barnet-Lamb
Programmer, Lionhead Studios Ltd.
www.lionhead.com