Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > template specia...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 44122 of 48044
Post > Topic >>

template specialization

by Rahul <sam_cit@[EMAIL PROTECTED] > Mar 26, 2008 at 01:54 AM

Hi Everyone,

 I have the following code,


template<typename T>
void funn(T a)
{
 printf("function invoked...\n");
}

template<>
void funn<int>(int aa)
{
 printf("second function is invoked...\n");
}

void funn(int a)
{
 printf("third function is invoked...\n");
}


int main()
{
 funn(2);
}


 And i get the following output,

 third function is invoked...

But i expected a compilation error "funn(int) redefined", does the
standard say anything about this?

Thanks in advance ! ! !
 




 7 Posts in Topic:
template specialization
Rahul <sam_cit@[EMAIL   2008-03-26 01:54:25 
Re: template specialization
v.sobkowski@[EMAIL PROTEC  2008-03-26 02:08:05 
Re: template specialization
Rahul <sam_cit@[EMAIL   2008-03-26 02:17:35 
Re: template specialization
Juha Nieminen <nospam@  2008-03-26 11:45:27 
Re: template specialization
Rahul <sam_cit@[EMAIL   2008-03-26 02:41:10 
Re: template specialization
Rahul <sam_cit@[EMAIL   2008-03-26 04:22:54 
Re: template specialization
gnuyuva <gnuyuva@[EMAI  2008-03-26 07:14:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:37:45 CDT 2008.