Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!news.albasani.net!.POSTED!not-for-mail From: "peter miller" Newsgroups: comp.std.c++ Subject: Additional location for parameter pack expansion Date: Sat, 10 Sep 2011 00:29:42 -0700 (PDT) Organization: virginmedia.com Lines: 103 Sender: std-cpp-request@vandevoorde.com Approved: james.dennett@gmail.com Message-ID: Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes X-Trace: news.albasani.net UCLdFp0RFYXQFV7YsDS8fLM3QO7oqnXfzUI/SkIEgfHqsJpL/3aYlOMxbyOIbM+cdcILkt/CZ1gGIM3nGBMrRw== NNTP-Posting-Date: Sat, 10 Sep 2011 07:29:44 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="vEytaIxfyugt8X7gM518szirx3nmUevEfvjfA+ZyqTfHcPtNRyHyUyi5fYvoneaklyGlWrgiWhilryQ9sSkMKC7izssDizuGdX+whKfUfUGoj/DC8ciT+Htb4B4kqxjI"; mail-complaints-to="abuse@albasani.net" X-Mailer: Perl5 Mail::Internet v2.05 X-Submission-Address: std-cpp-submit@vandevoorde.com Cancel-Lock: sha1:jSSSlMPsMSnDK3gO2a7yzzgK5G4= X-Original-Date: Fri, 09 Sep 2011 10:26:51 +0100 Xref: x330-a1.tempe.blueboxinc.net comp.std.c++:283 Hi all, I think the list of places where a pack expansion can appear (14.5.3/4 [temp.variadic]) should include using declarations; for example, I found myself wanting to code this: template struct x : Mixins... { using Mixins::some_method ...; // ****NOTE pack expansion. }; I can do the above, but it takes all this clutter: #include #include template struct s; template auto get_head( Head const&, Tail const&...) -> Head; template struct head { typedef decltype( get_head( std::declval()... ) ) type; }; template auto get_tail( Head const&, Tail const&... ) -> s; template struct tail { typedef decltype( get_tail( std::declval()... ) ) type; }; template struct s : head::type, tail::type { using head::type::print; using tail::type::print; }; template <> struct s<> { private: struct dummy_function; public: void print( dummy_function const& ); }; struct a { void print( int i ) { printf( "%d\n", i ); } }; struct b { void print( double d ) { printf( "%f\n", d ); } }; struct c { void print( const char* s ) { printf( "%s\n", s ); } }; static_assert( std::is_same< head::type ,a >::value && std::is_same< tail::type, s >::value, "test" ); int main() { s printer; printer.print( "hello" ); printer.print( 0.1 ); return 0; } Just a thought. Peter -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]