From: jon_bills AT hotmail DOT com (Jon Bills) Newsgroups: comp.lang.c++,comp.os.msdos.djgpp Subject: Re: More out from "cout".... Date: 8 Oct 2001 01:44:14 -0700 Organization: http://groups.google.com/ Lines: 35 Message-ID: <38315c2d.0110080044.40ead28d@posting.google.com> References: <9pque5$eui$1 AT tron DOT sci DOT fi> NNTP-Posting-Host: 195.99.244.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1002530654 21349 127.0.0.1 (8 Oct 2001 08:44:14 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: 8 Oct 2001 08:44:14 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Traveler" wrote in message news:<9pque5$eui$1 AT tron DOT sci DOT fi>... > Hi! > > Have you ever be annoyed to write code like this every time you just > want to list elements of some array ? > No. Never. > > "int someArray[] = {4,54,12,9,234,89,5}; > > unsigned long length = sizeof(table)/sizeof(table[0]); > > for(unsigned long index = 0;index < length;index++) > cout << someArray[index] << endl;" > > Wouldn?t it be nice to have it like this ? > > "int someArray[] = {4,54,12,9,234,89,5}; > cout << someArray << endl;" Maybe. > > Well, no fear when the Traveler is here ! ;) > I have just the thing you are looking for. I have overloaded the "<<" > operator for few table types and I trust that you can do the trick for > rest of the ones you want. > [snip] What's wrong with using a vector and for_each()? Jon.