User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 403,025 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,861 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums

template array initialization

Join Date: Jan 2005
Posts: 24
Reputation: crq is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
crq crq is offline Offline
Newbie Poster

Re: template array initialization

  #5  
Jan 28th, 2005
Originally Posted by Narue
>i can't initialize everything to 0 becuase what i pass in MAY not be ints.
I don't see what your problem is. If you read my answer you'll see that I used the default constructor for T (which works for built in types as well) as the replacement for 0. Did you try it? Or did you just assume that I haven't got a clue and proceed to give me irrelevant code snippets with the same question again?

so sorry. i didn't realize that you had made changes to the code. the changes were minor fixes that make a world of difference. i didn't see them though. i thought you were quoting the code and had put it up to show me why the asserts did/didn't work. now i see that you took out the one that wasn't ok, and that you inserted the T. thanks for your help. i will try it now. didn't mean to imply that you "haven't got a clue". obviously, i am the one who hasn't got a clue. i won't bother you again.

thanks
crq
Reply With Quote  
All times are GMT -4. The time now is 10:30 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC