$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Bergman (David.Bergman_at_[hidden])
Date: 2006-08-30 20:35:09
Jared,
std::bind1st was not meant to "freeze" operations, but just for simple
currying scenarios. As such, it expects a binary function as input. For a
more generic binder, use boost::bind. In fact, just replace std::bind1st
with boost::bind (and, yes, you can then skip that mem_fun altogether) and
include <boost/bind.hpp>.
I.e., your problem had nothing to do with boost::function.
Regards,
David
.--------------------------------------------.
| http://blog.davber.com = blah, blah , blah |
 -------------------------------------------- 
> -----Original Message-----
> From: boost-bounces_at_[hidden] 
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Jared McIntyre
> Sent: Wednesday, August 30, 2006 6:31 PM
> To: boost_at_[hidden]
> Subject: [boost] [Function] Can't attach to member without parameters
> 
> I'm sure I'm missing something pretty fundamental here.  I'm 
> trying to set a boost::function to a member function without 
> any parameters. The following code fails to build (using VS 
> 2005, haven't tested anything else). If I set it to a 
> non-member function it works fine.
> 
> #include <functional>
> #include <boost/function.hpp>
> 
> class test
> {
> public:
> 	int GetInt()
> 	{
> 		return 1;
> 	}
> };
> 
> int _tmain(int argc, _TCHAR* argv[])
> {
> 	test inst;
> 	boost::function<int ()> getter;
> 
>          // Getting several errors where it appears that <int 
> ()> isn't being handled
>          // as a signature when being handled by mem_fun. Not 
> sure whether that is related.
> 	getter = std::bind1st( std::mem_fun(&test::GetInt), &inst);
> 
> 	return 0;
> }
> _______________________________________________
> Unsubscribe & other changes: 
> http://listarchives.boost.org/mailman/listinfo.cgi/boost
>