- 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
- 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
"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
- 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 >
> >
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:
>
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)
> {
> // ...
> }
>
>
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
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"
>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
- 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
"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
- 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
- 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
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
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
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
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
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
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
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
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
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
"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.
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
>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
>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
"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
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
>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
"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())
30 matches
Mail list logo