|
Boost : |
From: Brunen, Johannes (jbrunen_at_[hidden])
Date: 2002-09-02 03:46:16
Hi Doug,
>> This works pretty fine. However, when I tried to use a slot functor
defined
>> in class A it doesn't compile anymore:
>>
>> class A
>> {
>> void somefun(X& x);
>> public:
>> struct SlotFunctor
>> {
>> SlotFunctor(A& a) : _a(a) {}
^ const
> SlotFunctor isn't CopyConstructible, so it can't be used with
Boost.Function
> (and, therefore, Boost.Signals). Let me know if that fixes the problem...
Finally, I found time to make the SlotFunctor CopyConstructible.
class A
{
void somefun(X& x);
public:
struct SlotFunctor
{
SlotFunctor() : _a(NULL) {}
SlotFunctor(A* a) : _a(a) {}
SlotFunctor(const SlotFunctor& r) : _a(r._a) {}
void operator() () const
{ ... }
A* _a;
};
However, with the same result i.e. error message:
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(97): error C2664:
'boost::reference_wrapper<XUIDlgTest::SlotOnClick const>
boost::signals::detail::slot_base::get_invocable_slot(const
XUIDlgTest::SlotOnClick &,boost::signals::detail::signal_tag)': cann
ot convert parameter 2 from 'boost::signals::detail::value_tag' to
'boost::signals::detail::signal_tag'
No constructor could take the source type, or constructor overload
resolution was ambiguous
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
' being compiled
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(97): error C2143: syntax error
: missing ')' before 'const'
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
' being compiled
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(97): error C2780: 'const F
&boost::signals::detail::slot_base::get_invocable_slot(const F
&,boost::signals::detail::value_tag)': expects 2 arguments - 1 provided
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(56): see declaration
of 'get_invocable_slot'
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
' being compiled
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(97): error C2780: 'const F
&boost::signals::detail::slot_base::get_invocable_slot(const F
&,boost::signals::detail::reference_tag)': expects 2 arguments - 1 provided
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(52): see declaration
of 'get_invocable_slot'
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
' being compiled
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(97): error C2780:
'boost::reference_wrapper<F>
boost::signals::detail::slot_base::get_invocable_slot(const F
&,boost::signals::detail::signal_tag)': expects 2 arguments - 1 provided
..\..\..\..\Comp\Boost\boost/signals/slot.hpp(48): see declaration
of 'get_invocable_slot'
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
' being compiled
..\..\..\..\Comp\STLport\stlport\stl/_alloc.h(358): fatal error C1004:
unexpected end of file found
D:\_2376\XCADdy\cpp\applic\common\ui\src\XUIDlgTest.cxx(210): see
reference to function template instantiation
'boost::slot<boost::function0<void,boost::empty_function_policy,boost::empty
_function_mixin,int>>(const XUIDlgTest::SlotOnClick &)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk