Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Thomas David Rivers Newsgroups: comp.lang.c++ Subject: Re: Problem with array objects Date: Wed, 25 May 2011 12:01:59 -0400 Organization: Aioe.org NNTP Server Lines: 54 Message-ID: <4DDD27F7.3080009@dignus.com> References: <9PDzp.2011$Am5.1296@newsfe05.ams2> <846dndOds94DPEbQnZ2dnUVZ8ridnZ2d@giganews.com> <5cadnQfIzuppjUHQnZ2dnUVZ8kidnZ2d@giganews.com> <805Dp.26220$7H.26163@newsfe08.ams2> <4DDD0AE0.9080001@dignus.com> NNTP-Posting-Host: 5vmandCOS2XnoG0+Ic8whg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20061027 X-Accept-Language: en-us, en X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:5507 Alf P. Steinbach /Usenet wrote: > > No, that's incorrect. > > For example: > > struct S > { > template< int n > > void operator<<( int (&)[n] ) > { > cout << "Your array has " << n << " elements.\n"; > } > }; > > int main() > { > int arr[6]; > S stream; > > stream << arr; > } > > > Cheers & hth., > > - Alf > Ah yes - you're correct.... I was over-simplifying... (neglecting templates and function-overloading situations...) I should have said that I was speaking in more simple terms. Basic C-like expressions... And, I think, my assertion breaks down in the delete[] situation as well. (Although, in your example, you didn't access the 'arr' array, only the number of elements.... so, a twisted argument in the template situation could be had... but, in truth, my "blanket" statement is clearly too simple.) I tend to lean more toward "C-isms" where the type is less involved in distinguishing behavior. I was also trying to motivate the idea of "pointer to first element". Hopefully, my attempt to make that point isn't lost in the morass of other issues. - Dave Rivers - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com