|
Boost : |
From: Taggu Ani (ataggu_at_[hidden])
Date: 2002-04-01 20:17:46
Hello:
I have a function ptr of type CBRoutineT below.
struct OpaqueDataT; //incomplete type decl ok because
only ptr used?
typedef void CBRoutineT(OpaqueDataT *);
When I do this everything is ok:
boost::function<void, OpaqueDataT *> f1 =
yieldcallback; //ok
where yieldcallback is of type CBRoutineT *).
However, I want to assign 'yieldcallback' to a
function object wrapper of type:
boost::function<void, boost::any>
The first argument has changed from OpaqueDataT * to
boost::any. That does not work.
//replacing the arg from OpaqueDataT * to boost::any
gives error.
boost::function<void, boost::any> f2 = yieldcallback;
//error
VC++ 6.0 issues the error:
c:\virtualsilicon\vs\vre\debuggers\shared\boost\function\function_template.h
pp(94) : error C2664: 'void (struct OpaqueDataT *)' :
cannot convert parameter 1 from 'class boost::any' to
'struct OpaqueDataT *'
What is the right way to handle this?
Thanks,
-Ani
//---- example program -----
#include "boost/any.hpp"
#include "boost/function.hpp"
struct OpaqueDataT; //incomplete type ok because only
ptr used?
typedef void CBRoutineT(OpaqueDataT *);
void MyCB (CBRoutineT *yieldcallback, OpaqueDataT
*cbdata)
{
boost::function<void, OpaqueDataT *> f1 =
yieldcallback; //ok
//replacing the arg from OpaqueDataT * to boost::any
gives error.
boost::function<void, boost::any> f2 = yieldcallback;
//error
}
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk