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
Re: [boost] Re: MPL usage for code generation
by =?iso-8859-1?Q?Terje_Sletteb=F8?= other posts by this author
Jan 23 2003 2:39AM messages near this date
Re: [boost] Re: MPL usage for code generation | Re: [boost] Re: MPL usage for code generation
> From: "David Abrahams" <dave@[...].com>

>  "Andrei Alexandrescu" <andrewalex@[...].com> writes:
> 
>  > Or (barring my lack of mastering some syntactic details):
>  >
>  > 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());
>  >
>  > No struct, no for_each, no operator(). Et que le meilleur gagne :o).
> 
>  Yeah, I haven't always been very comfortable with the
>  value-per-character of mpl::for_each -- it seems to have similar
>  properties to std::for_each in that way.

Perhaps it might be possible to do some compile-time/run-time lambda
(similar to Boost.Lambda for runtime, and MPL's lambda), so you could do
something like:

mpl::for_each<my_list> (my_function<_>(s));

It would then transform the function call "my_function<_> (s)" into an
instantiated function object of the kind suitable for mpl::for_each.

That would collapse the 7 or 12-line solution to one line. :)


Regards,

Terje

_______________________________________________
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