[GD-Windows] Array member pointer problem: Visual Studio or me?
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2007-05-15 16:42:12
|
I'm having a problem where pointer to member array returns the first array element as a pointer to array type. There are no skanky casts involved in the code, so I believe this is a bug in Visual Studio 2003. Does anyone here agree or disagree? template<typename Container, typename FieldType, size_t Count, FieldType (Container::*Field)[Count]> class ArrayRef { public: FieldType const *Access(Container *c) { return c->*Field; } }; class TemplateTest { float foo[10]; public: TemplateTest() { foo[0] = 1.0f; ArrayRef<TemplateTest, float, 10, &TemplateTest::foo> ar; float const *p = ar.Access(this); assert(p == foo); // p is 0x3f800000 here in msvc 2003 } }; TemplateTest testIt; Cheers, / h+ |