typedef and pass variable

Mohsen Pahlevanzadeh mohsen@pahlevanzadeh.org
Mon Jul 9 08:03:00 GMT 2012


I changed the given func to the :
///////////////////////////////////
template <class T,class MyCLass>
Class *makeInstance(T *_class,Method _method,Class* _instance_class,ReturnType _returnType,Parameter1 parameter1,Parameter2 parameter2, Parameter3 parameter3, Parameter4 parameter4){
typedef (&_class) __class ;
typedef MyCLass<__class, ReturnType, Parameter1, Parameter2, Parameter3, Parameter4>  callback;
__class cptr(1);
callback cptr(&_instance_class, &_method);
};
/////////////////////////////////////
and get the following errors:
//////////////////////////////////
49:24: error: expected initializer before ‘__class’
50:14: error: ‘EventHandlerAbstract’ is not a template
50:35: error: ‘__class’ was not declared in this scope
51:14: error: expected ‘;’ before ‘cptr’
//////////////////////////////////
Seriously  i stay to pass variable to typedef...
--mohsen
On Mon, 2012-07-09 at 11:57 +0430, Mohsen Pahlevanzadeh wrote:
> Dear all,
> Suppose i have a func such as a following func:
> ////////////////////
> template <class T>
> Class *makeInstance(T *_class,Method _method,Class* _instance_class,ReturnType _returnType,Parameter1 parameter1,Parameter2 parameter2, Parameter3 parameter3, Parameter4 parameter4){
> typedef MyCLass< &_class, ReturnType, Parameter1, Parameter2, Parameter3, Parameter4>  cbd;
> };
> /////////////////////////
> In typedef line, i must pass class name as argumnent , how i do it?
> When i put a real class name instead of _class my error is solved.
> 
> --Best Regards
> Mohsen
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 316 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20120709/3cfdcbb1/attachment.sig>


More information about the Gcc-help mailing list