It works on my compiler.
maybe -
int main(int argc, char** argv)
{
signal<int>* psig = createSignal(1);
}
will give an error because the compiler cannot deduce the type of 'Type' in
Signal<Type>,
but:
int main(int argc, char** argv)
{
signal<int>* psig = createSignal<int>(1);
}
(for example) is fine. I think this is down to ADL (argument dependant
lookup) but happy to be corrected.
regards,
Aiden
<au******@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
template<class Type>
struct signal
{
int num;
Type* pData;
};
//--------method--------
template<class Type>
signal<Type>* createSignal(const int num){
signal<Type>* pSignal = new signal<Type>;
pSignal->num = num;
pSignal->pData = new Type[num];
return pSignal;
}
It does not compile, why? how to fix it?
Thanks,
goor
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com