Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 01-13-2006, 07:49 AM   #1 (permalink)
 
Junior Techie

Join Date: Jun 2005

Posts: 94

ever_thus

Default undefined type in C++

I'm writing a template class in C++ which, among other things, fills arrays passed to member functions. Occasionally the array might be larger than the data structure from which it's being filled. I'd like to fill the excess elements with data that it will be clear did not come the class.

If I leave the element untouched, the garbage in there could be interperted as valid data, as could any "flag" value I can think of. A further complication is that the data could be of any type.

A solution that works in C too would be more useful, as I anticipate encountering this problem again in the future.
ever_thus is offline  
Old 01-13-2006, 02:46 PM   #2 (permalink)
 
Ultra Techie

Join Date: Jul 2005

Posts: 530

TheHeadFL

Send a message via AIM to TheHeadFL
Default

Your member functions could just return an integer value that indicates the number of cells that are filled.
__________________
Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache)
TheHeadFL is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On