| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"" |
| Date: |
25 Jan 2008 11:48:17 AM |
| Object: |
Question about Pointer to Member Typedefs inside templates |
Hi,
Can anyone please tell me why this code is giving me a C2327 error? I
am using Visual C++ 2008.
template<class T, int T::*IntMemberOfT>
class Foo
{
};
class Bar
{
public:
int memberOfBar;
typedef Foo<Bar, &Bar::memberOfBar> TypeDefedFooBar;
};
The errors I see are:
error C2327: 'Bar::memberOfBar' : is not a type name, static, or
enumerator => Why am I seeing this one?
error C2065: 'memberOfBar' : undeclared identifier => This one will
probably go away once C2327 is gone.
If I move the type definition outside of Bar's scope it compiles
successfully.
Thanks
Waseem
.
|
|
| User: "Victor Bazarov" |
|
| Title: Re: Question about Pointer to Member Typedefs inside templates |
25 Jan 2008 01:18:34 PM |
|
|
wrote:
Can anyone please tell me why this code is giving me a C2327 error? I
am using Visual C++ 2008.
template<class T, int T::*IntMemberOfT>
class Foo
{
};
class Bar
{
public:
int memberOfBar;
typedef Foo<Bar, &Bar::memberOfBar> TypeDefedFooBar;
};
The errors I see are:
error C2327: 'Bar::memberOfBar' : is not a type name, static, or
enumerator => Why am I seeing this one?
error C2065: 'memberOfBar' : undeclared identifier => This one will
probably go away once C2327 is gone.
If I move the type definition outside of Bar's scope it compiles
successfully.
There seems to be no specific difference except that if you move
the typedef outside, 'Bar' is now a complete type. It can just
be a bug in the compiler. You should probably ask in the Visual
C++ newsgroup as well.
Try compiling your test program with online Comeau trial. If it
compiles it successfully, mention that in the VC++ newsgroup.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
|

|
Related Articles |
|
|