ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[PMX:#] [boost] Re: MPL usage for code generation
by Andrei Alexandrescu other posts by this author
Jan 24 2003 7:46PM messages near this date
[boost] MPL usage for code generation | [boost] Re: MPL usage for code generation
"Hugo Duncan" <hugoduncan@[...].net>  wrote in message
news:1105_1043370662@[...]..
>  On Wed, 22 Jan 2003 16:25:40 -0800, "Andrei Alexandrescu"
<andrewalex@[...].com>  wrote:
>  >
>  > inline void do_my_function(string&, void_) {}
>  >
>  > template <class Lst>
>  > inline void do_my_function(string& s, Lst lst)
>  > {
>  >     my_function<front<Lst>::type>(s);
>  >     do_my_function(s, pop_front<Lst>::type());
>  > }
>  > ....
>  > do_my_function(s, my_list());
>  >
> 
>  This is interesting as it also gives run-time control of how much of the
list
>  is iterated over.
> 
>  eg.
> 
>  template <class Lst>
>  inline void do_my_function(string& s, Lst lst)
>  {
>     if (!my_function<front<Lst>::type>(s))
>        do_my_function(s, pop_front<Lst>::type());
>  }

To add compliment to healing, an additional advantage is that you don't even
need to get for_each to compile.

Andrei



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Hugo Duncan
Andrei Alexandrescu
Hugo Duncan
Hugo Duncan
Hugo Duncan
David Abrahams
Peter Dimov
David Abrahams
=?iso-8859-1?Q?Terje_Sletteb=F8?=
=?iso-8859-1?Q?Terje_Sletteb=F8?=
=?iso-8859-1?Q?Terje_Sletteb=F8?=
David Abrahams
Hugo Duncan
Andrei Alexandrescu
David Abrahams
David Abrahams
Andrei Alexandrescu
David Abrahams
Douglas Paul Gregor
David Abrahams
Douglas Paul Gregor
David Abrahams
Douglas Paul Gregor
David Abrahams
Douglas Paul Gregor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved