-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
The code for const function delegates causes a compilation error in VC++ 2013:
template<typename return_type, typename... params>
class Delegate<return_type(params...) const>
: public BaseDelegate<return_type, params...>
{
typedef BaseDelegate<return_type, params...> Base;
public:
Delegate(void* callee, typename Base::Pointer2Function function)
: Base(callee, function)
{ }
};
error C2953: 'Delegate<return_type(params...),>' : class template has already been defined.
Which also causes an error further down in the file:
template<return_type(T::*Func)(params...) const>
inline static Delegate<return_type(params...) const> CreateC(T* o)
{
return Delegate<return_type(params...) const>(o, &DelegateFactory::MethodCallerC<Func>);
}
'abstract declarator' : modifiers not allowed on nonmember functions
Here is what is needed for it to fully build:
#ifndef _MSC_VER
template<typename return_type, typename... params>
class Delegate<return_type(params...) const>
: public BaseDelegate<return_type, params...>
{
typedef BaseDelegate<return_type, params...> Base;
public:
Delegate(void* callee, typename Base::Pointer2Function function)
: Base(callee, function)
{ }
};
#endif
...
#ifdef _MSC_VER
template<return_type(T::*Func)(params...) const>
inline static Delegate<return_type(params...)/* const*/> CreateC(T* o)
{
return Delegate<return_type(params...)/* const*/>(o, &DelegateFactory::MethodCallerC<Func>);
}
#else
template<return_type(T::*Func)(params...) const>
inline static Delegate<return_type(params...) const> CreateC(T* o)
{
return Delegate<return_type(params...) const>(o, &DelegateFactory::MethodCallerC<Func>);
}
#endif
Were you able to get this to build in Visual C++?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels