Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Joel de Guzman
- Original Message - From: "Joel de Guzman" <[EMAIL PROTECTED]> > A good start is libs/phoenix/test/functors_tests.cpp > and libs/phoenix/example/fundamental/sample3.cpp > There are jamfiles in there FWIW. BTW, here's the lambda-lambda solution posed by Joel Young: #include #include

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Joel de Guzman
- Original Message - From: "David Abrahams" <[EMAIL PROTECTED]> > >> This is way too cool! Now we only need to provide such free-standing forms > >> of all STL algorithms/member functions, and we will be living in a different > >> world: > >> > >> std::vector v; > >> > >> push_b

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread David Abrahams
"Joel de Guzman" <[EMAIL PROTECTED]> writes: > - Original Message - > From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > > >> Joel de Guzman wrote: >> > Here's the Phoenix version: >> > >> > struct my_function_ >> > { >> > >> > template >> > struct result { typedef

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Joel de Guzman
- Original Message - From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > Joel de Guzman wrote: > > Here's the Phoenix version: > > > > struct my_function_ > > { > > > > template > > struct result { typedef void type; }; > > > > template< typename U > > >

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Peter Dimov
From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > Joel de Guzman wrote: > > > > mpl::for_each< my_types >(my_function(text, _1)); > > This is way too cool! Now we only need to provide such free-standing forms > of all STL algorithms/member functions, and we will be living in a different > world: >

RE: [boost] Re: MPL usage for code generation

2003-01-24 Thread Aleksey Gurtovoy
Joel de Guzman wrote: > Here's the Phoenix version: > > struct my_function_ > { > > template > struct result { typedef void type; }; > > template< typename U > > void operator()(std::string const& text, U) > { > // ... > } > >

RE: [boost] Re: MPL usage for code generation

2003-01-24 Thread Aleksey Gurtovoy
Hugo Duncan wrote: > Including for_each.hpp on bcc561 gives > > Error E2230 > c:\usr\boost\boost/mpl/aux_/preprocessed/bcc/template_arity.hp > p 20: In-line data member initialization requires an integral > constant expression > > Any chance of finding a fix for this? I am having problems > w

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread David Abrahams
Terje Slettebø <[EMAIL PROTECTED]> writes: >>From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> >> >> std::string text("text"); >> mpl::for_each< my_types >(boost::bind(my_function, text, _1)); > > I got "error: no instance of function template "boost::mpl::for_each" > matches the argument list"

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Terje Slettebø
>From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > David Abrahams wrote: > > > > It appears to be just bad luck that higher order functional > > programming with function templates is impossible in C++. > > My current understanding (which, admittedly, is not backed up by a > real-world experience) is

Re: [boost] Re: MPL usage for code generation

2003-01-24 Thread Joel de Guzman
- Original Message - From: "David Abrahams" <[EMAIL PROTECTED]> > > This technique is adopted by Phoenix. With this, you can even do > > (as suggested by Joel Young): > > > > - \ \ > > double - /\ f . /\ x. f(f x) > > - / \ / \ > > > > struct squa

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
"Joel de Guzman" <[EMAIL PROTECTED]> writes: > - Original Message - > From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > >> My current understanding (which, admittedly, is not backed up by a >> real-world experience) is that if you care about higher-orderness of your >> generic algorithms, a

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Joel de Guzman
- Original Message - From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > My current understanding (which, admittedly, is not backed up by a > real-world experience) is that if you care about higher-orderness of your > generic algorithms, a preferred implementation construct for those > algor

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Joel de Guzman
- Original Message - From: "Aleksey Gurtovoy" <[EMAIL PROTECTED]> > My current understanding (which, admittedly, is not backed up by a > real-world experience) is that if you care about higher-orderness of your > generic algorithms, a preferred implementation construct for those > algorit

RE: [boost] Re: MPL usage for code generation

2003-01-23 Thread Aleksey Gurtovoy
David Abrahams wrote: > Terje Slettebø <[EMAIL PROTECTED]> writes: > > 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_function<_>(s)); > > > > It would th

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Douglas Paul Gregor
On Thu, 23 Jan 2003, David Abrahams wrote: > Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > > > On Thu, 23 Jan 2003, David Abrahams wrote: > >> No, I mean the complexity-of-expression issue. > > > > Hmmm, I don't see how that issue applies. > > I don't know what you mean by that. Are you sayin

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > On Thu, 23 Jan 2003, David Abrahams wrote: > >> Douglas Paul Gregor <[EMAIL PROTECTED]> writes: >> >> > On Thu, 23 Jan 2003, David Abrahams wrote: >> >> AFAICT it >> >> doesn't solve the problem that Andrei was pointing at. >> > >> > You mean the f

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Douglas Paul Gregor
On Thu, 23 Jan 2003, David Abrahams wrote: > Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > > > On Thu, 23 Jan 2003, David Abrahams wrote: > >> AFAICT it > >> doesn't solve the problem that Andrei was pointing at. > > > > You mean the front/pop_front issue? > > No, I mean the complexity-of-expr

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
Hugo Duncan <[EMAIL PROTECTED]> writes: > Including for_each.hpp on bcc561 gives > > Error E2230 > c:\usr\boost\boost/mpl/aux_/preprocessed/bcc/template_arity.hpp > 20: In-line data member initialization requires an > integral constant expression > > Any chance of finding a fix for this? I am hav

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > On Thu, 23 Jan 2003, David Abrahams wrote: > >> Douglas Paul Gregor <[EMAIL PROTECTED]> writes: >> >> > Why don't we have >> > >> > mpl::list list_of_types; >> > for_each(list_of_types.begin(), list_of_types.end(), f); >> > >> > ? >> > >> > The

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Douglas Paul Gregor
On Thu, 23 Jan 2003, David Abrahams wrote: > Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > > > Why don't we have > > > > mpl::list list_of_types; > > for_each(list_of_types.begin(), list_of_types.end(), f); > > > > ? > > > > Then an unqualified for_each call can handle type sequences, he

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
Douglas Paul Gregor <[EMAIL PROTECTED]> writes: > Why don't we have > > mpl::list list_of_types; > for_each(list_of_types.begin(), list_of_types.end(), f); > > ? > > Then an unqualified for_each call can handle type sequences, heterogeneous > containers (e.g., tuple), and run-time sequences (e

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Douglas Paul Gregor
On Wed, 22 Jan 2003, David Abrahams wrote: > I've been talking with Aleksey recently about how to improve the > syntactic situation without losing the separation of concerns that we > get, but we didn't come up with anything convincingly better. I think > a long time ago the for_each parameter use

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread David Abrahams
"Peter Dimov" <[EMAIL PROTECTED]> writes: > From: "David Abrahams" <[EMAIL PROTECTED]> >> >> I've been talking with Aleksey recently about how to improve the >> syntactic situation without losing the separation of concerns that we >> get, but we didn't come up with anything convincingly better.

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Peter Dimov
From: "David Abrahams" <[EMAIL PROTECTED]> > > I've been talking with Aleksey recently about how to improve the > syntactic situation without losing the separation of concerns that we > get, but we didn't come up with anything convincingly better. I think > a long time ago the for_each parameter

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Terje Slettebø
>From: "Terje Slettebø" <[EMAIL PROTECTED]> > > I can imagine something like this: > > template void Function(T)> > struct for_each; > > Possibly using overloaded class templates, as well (another possible > extension). Come to think of it, the latter wouldn't be needed here, as for_each is a func

Re: [boost] Re: MPL usage for code generation

2003-01-23 Thread Terje Slettebø
>From: "David Abrahams" <[EMAIL PROTECTED]> > > Terje Slettebø <[EMAIL PROTECTED]> writes: > > > > 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_function

Re: [boost] Re: MPL usage for code generation

2003-01-22 Thread David Abrahams
"Andrei Alexandrescu" <[EMAIL PROTECTED]> writes: > "David Abrahams" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Yeah, I haven't always been very comfortable with the >> value-per-character of mpl::for_each -- it seems to have similar >> properties to s

Re: [boost] Re: MPL usage for code generation

2003-01-22 Thread David Abrahams
Terje Slettebø <[EMAIL PROTECTED]> writes: >>From: "David Abrahams" <[EMAIL PROTECTED]> > >> "Andrei Alexandrescu" <[EMAIL PROTECTED]> writes: >> >> > Or (barring my lack of mastering some syntactic details): >> > >> > inline void do_my_function(string&, void_) {} >> > >> > template >> > inline v

Re: [boost] Re: MPL usage for code generation

2003-01-22 Thread Terje Slettebø
>From: "David Abrahams" <[EMAIL PROTECTED]> > "Andrei Alexandrescu" <[EMAIL PROTECTED]> writes: > > > Or (barring my lack of mastering some syntactic details): > > > > inline void do_my_function(string&, void_) {} > > > > template > > inline void do_my_function(string& s, Lst lst) > > { > > m

Re: [boost] Re: MPL usage for code generation

2003-01-22 Thread David Abrahams
"Andrei Alexandrescu" <[EMAIL PROTECTED]> writes: > Or (barring my lack of mastering some syntactic details): > > inline void do_my_function(string&, void_) {} > > template > inline void do_my_function(string& s, Lst lst) > { > my_function::type>(s); > do_my_function(s, pop_front::type())