We have run into a problem with code generated by Py++ involving
pointers to member templates. For example, consider this class:
class C
{
public:
template<typename T>
T getValue() const
{
return static_cast<T>(mValue);
}
private:
int mValue;
};
The code generated by Py++ to expose C::getValue() will include
something similar to the following:
typedef int (C::* ptr_type)() const;
ptr_type p = ptr_type(&C::getValue);
The above does not compile with Visual C++ 7.1, though it does compile
with 8.0 and 9.0. For Visual C++ 7.1, the following syntax must be used:
typedef int (C::* ptr_type)() const;
ptr_type p = ptr_type(&C::getValue<int>);
While I do not have a deep familiarity with the C++ standard,
including the template parameter in the pointer-to expression is what
I would try to write if I were coding this up manually. Is the second
form incorrect or just unnecessarily verbose?
Given that the pointer-to expression without the template parameter
does compile with newer versions of Visual C++, I have to think that
this is a bug in or a limitation of Visual C++ 7.1. If including the
template parameter in the pointer-to expression is valid, could a
change be made to Py++ to include that extra information so that the
code it generates can be built with Visual C++ 7.1?
-Patrick
--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/
|