424,987 Members | 971 Online
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

# initialization of built in types in templates

 P: n/a // THIS CODE: template
8 Replies

 P: n/a Gernot Frisch wrote: // THIS CODE: template

 P: n/a "Gernot Frisch" // THIS CODE: template

 P: n/a Gernot Frisch wrote: > // THIS CODE: template

 P: n/a "Jim Langston" "Gernot Frisch" >// THIS CODE:template data[0] = t; Although you could just do it here: data[0] = t(); er, data[0] = T(); is what I meant. > >} T data[5];}; int main(int, char**){C

 P: n/a >What can I do to make it work with built in variables, initializedas0? What do you want it to do? Is data[0] = T(); what you want? Doh! thank you Jun 21 '07 #6

 P: n/a T t(); didn't work for . It's trying to assign a function then. Ian's solution did it, though. Thx for quick response. Jun 21 '07 #7

 P: n/a On 21 Jun, 09:07, "Gernot Frisch" . It's trying to assign a function then. not just for unsigned char. T t(); declares function T (*)(void). you either do T t = T(); data[0] = t; or data[0] = T(); Ian's solution did it, though. Thx for quick response. check boost::value_intialized if you have to do the same for non POD types. regards DS Jun 21 '07 #8

 P: n/a Jim Langston >// THIS CODE:template data[0] = t; Although you could just do it here: data[0] = t(); data[0] = T(); as others have mentioned (including yourself in a later post). -- Marcus Kwok Replace 'invalid' with 'net' to reply Jun 21 '07 #9

### This discussion thread is closed

Replies have been disabled for this discussion.