|
From: <mor...@us...> - 2010-09-08 13:38:25
|
Revision: 3856
http://ecell.svn.sourceforge.net/ecell/?rev=3856&view=rev
Author: moriyoshi
Date: 2010-09-08 13:38:16 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
* MSVC cannot gracefully handle template overloaded functions with a function pointer as its template argument.
Modified Paths:
--------------
ecell3/trunk/ecell/libecs/MethodProxy.hpp
ecell3/trunk/ecell/libecs/scripting/Assembler.cpp
Modified: ecell3/trunk/ecell/libecs/MethodProxy.hpp
===================================================================
--- ecell3/trunk/ecell/libecs/MethodProxy.hpp 2010-09-08 10:47:26 UTC (rev 3855)
+++ ecell3/trunk/ecell/libecs/MethodProxy.hpp 2010-09-08 13:38:16 UTC (rev 3856)
@@ -118,19 +118,19 @@
return theInvoker( theObject );
}
- template < class T, RET (T::*TMethod)() >
+ template < typename T, RET (T::*TMethod)() >
static ObjectMethodProxy create( T* anObject )
{
- return ObjectMethodProxy( &invoke<T,TMethod>, anObject );
+ return ObjectMethodProxy( reinterpret_cast< Invoker >( &invoke< T, TMethod > ), anObject );
}
- template < class T, RET (T::*TMethod)() const >
- static ObjectMethodProxy create( T* anObject )
+ template < typename T, RET (T::*TMethod)() const >
+ static ObjectMethodProxy createConst( T const* anObject )
{
- return ObjectMethodProxy( &invoke<T,TMethod>, anObject );
+ return ObjectMethodProxy( reinterpret_cast< Invoker >( &invokeConst< T, TMethod > ), const_cast< T* >( anObject ) );
}
- inline bool operator==( ObjectMethodProxy const& that ) const
+ inline bool operator==( ObjectMethodProxy const& that ) const
{
return that.theInvoker == theInvoker;
}
@@ -151,15 +151,15 @@
}
template < class T, RET (T::*TMethod)() >
- static RET invoke( void* anObject )
+ static RET invoke( T* anObject )
{
- return ( static_cast<T*>(anObject)->*TMethod )();
+ return ( anObject->*TMethod )();
}
template < class T, RET (T::*TMethod)() const >
- static RET invoke( void* anObject )
+ static RET invokeConst( T const* anObject )
{
- return ( static_cast<T const*>(anObject)->*TMethod )();
+ return ( anObject->*TMethod )();
}
private:
Modified: ecell3/trunk/ecell/libecs/scripting/Assembler.cpp
===================================================================
--- ecell3/trunk/ecell/libecs/scripting/Assembler.cpp 2010-09-08 10:47:26 UTC (rev 3855)
+++ ecell3/trunk/ecell/libecs/scripting/Assembler.cpp 2010-09-08 13:38:16 UTC (rev 3856)
@@ -41,14 +41,14 @@
appendInstruction\
( Instruction<OBJECT_METHOD_REAL>\
( RealObjectMethodProxy::\
- create< CLASSNAME, & CLASSNAME::METHODNAME >\
+ createConst< CLASSNAME, & CLASSNAME::METHODNAME >\
( OBJECT ) ) ) // \
#define APPEND_OBJECT_METHOD_INTEGER( OBJECT, CLASSNAME, METHODNAME )\
appendInstruction\
( Instruction<OBJECT_METHOD_INTEGER>\
( IntegerObjectMethodProxy::\
- create< CLASSNAME, & CLASSNAME::METHODNAME >\
+ createConst< CLASSNAME, & CLASSNAME::METHODNAME >\
( OBJECT ) ) ) // \
void
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|