From -8271670986339728822 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,782fb3724018b13e X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2001-05-19 11:49:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail From: "David Abrahams" Newsgroups: comp.std.c++ Subject: Re: All I want for Christmas (was C++0x) Date: Sat, 19 May 2001 18:48:53 GMT Organization: Road Runner Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: References: <9dpnro$j7ajt$1@ID-14036.news.dfncis.de> <153N6.24719$p33.428418@news1.sttls1.wa.home.com> X-Trace: mail2news.demon.co.uk 990298138 mail2news:4331 mail2news mail2news.demon.co.uk X-Complaints-To: abuse@demon.net X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Date: Sat, 19 May 2001 10:20:03 EDT Lines: 36 Xref: archiver1.google.com comp.std.c++:4992 "Paul Mensonides" wrote in message news:153N6.24719$p33.428418@news1.sttls1.wa.home.com... > Hey, Andrei, what do you think of some type of templated parameter list? For > example... > > template class SomeCollection { > private: > unsigned m_size; > T* m_v; > public: > template void for_each(U (T::* pm)(V), V) { > for (int i = 0; i < m_size; ++i) { > m_v[i].*pm(#V); // #V indicates values rather than type > } > } > }; Something like this is on my big-10 list of missing template features. It is a sad fact of C++ programming that many idioms require the writing of forwarding functions. Doing this with templates can get really frustrating when they need overloads to deal with all the different combinations. Usually, I have to resort to C++ code generation (using, e.g., Python) just to ensure I don't make any mistakes. I rather like your syntax, too, though it should be possible to lose the pound sign (why not just declare v of type V?) and the parens around the ellipsis (they seem to indicate a function). -Dave --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.research.att.com/~austern/csc/faq.html ]