|
Boost Users : |
From: Sergey Ostrovskiy (sostrovskiy_at_[hidden])
Date: 2007-02-15 10:57:00
"Peter Dimov" <pdimov_at_[hidden]> wrote in message news:<008801c75115$0caf8120$6607a8c0_at_pdimov2>...
óÅÒÇÅÊ ïÓÔÒÏ×ÓËÉÊ wrote:
> I have a problem. Here is example of my code:
> Now I want to output to a stream some fields of CAddress class. I can
> get a reference to CAddress object with the CItem::GetAddress method.
> So I am writing something like it:
>
> apReports.push_back(make_report(boost::bind(&CAddress::GetName,boost::mem_fun(&CItem::GetAddress)));
> apReports.push_back(make_report(boost::bind(&CAddress::GetSize,boost::mem_fun(&CItem::GetAddress)));
>
> these 2 lines are not compiled.
>Use
> boost::bind( &CAddress::GetName, boost::bind( &CItem::GetAddress, _1 ) )
Peter, you are better! I think that should be simple solution. Thank you!
Now I want to write something more difficult:
apReports.push_back(make_report(boost::lambda::bind(&CItem::GetItemCount)*boost::lambda::bind((&CItem::GetItemBytes)));
or
apReports.push_back(make_report(boost::lambda::bind(&CItem::GetItemCount)*100.0/boost::lambda::bind((&CItem::GetTotalCount)));
Is there any way to make it with boost library?
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
----------
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net