Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / January 2004



Tip: Looking for answers? Try searching our database.

Bizarre compilation error when using boost::signals

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Lalonde - 07 Jan 2004 21:13 GMT
Hi All,

I am trying to use boost::signals in my application, and I've run into a
problem.

I try to connect to a signal using a pointer-to-member function set up
with boost::bind.  The code (greatly simplified for posting) is similar
to this:

extern boost::signal1<void, class ModelItem*> sig;

class BrowserItem
{
  BrowserItem::BrowserItem()
  {
    sig.connect(boost::bind(&BrowserItem::MyHandleSig, this, _1));
  }

  void MyHandleSig(class ModelItem*);
};

The call to connect generates the error message below.  There appears to
be some kind of mismatch in the data types used by some deeply nested
template instantiations.  But I'm a bit stumped as to the exact cause,
much less a solution.

Any ideas?

BTW, this is using CW 8.3 on 10.3.2, in a Mach-O project using the BSD
headers.

-------------------------------------------------------------------------

Error   : function call 'visit_each({lval}
boost::signals::detail::bound_objects_visitor, {lval} BrowserItem *const
, int)' does not match
'boost::visit_each<...>(__T0 &, const boost::_bi::value<__T1> &, int)'
 (point of instantiation: 'BrowserItem::BrowserItem(ModelItem *,
B::OSPtr<OpaqueMenuRef *>)')
  (instantiating: 'boost::slot<boost::function1<void, ModelItem *,
std::allocator<boost::function_base>>>::slot<boost::_bi::bind_t<void,
boost::_mfi::mf1<void, BrowserItem, ModelItem *>,
boost::_bi::list2<boost::_bi::value<BrowserItem *>,
boost::arg<1>>>>(const boost::_bi::bind_t<void, boost::_mfi::mf1<void,
BrowserItem, ModelItem *>,
boost::_bi::list2<boost::_bi::value<BrowserItem *>, boost::arg<1>>> &)')
   (instantiating:
'boost::visit_each<boost::signals::detail::bound_objects_visitor,
boost::_bi::bind_t<void, boost::_mfi::mf1<void, BrowserItem, ModelItem
*>, boost::_bi::list2<boost::_bi::value<BrowserItem *>,
boost::arg<1>>>>(boost::signals::detail::bound_objects_visitor &, const
boost::_bi::bind_t<void, boost::_mfi::mf1<void, BrowserItem, ModelItem
*>, boost::_bi::list2<boost::_bi::value<BrowserItem *>, boost::arg<1>>> &)')
    (instantiating:
'boost::visit_each<boost::signals::detail::bound_objects_visitor, void,
boost::_mfi::mf1<void, BrowserItem, ModelItem *>,
boost::_bi::list2<boost::_bi::value<BrowserItem *>,
boost::arg<1>>>(boost::signals::detail::bound_objects_visitor &, const
boost::_bi::bind_t<void, boost::_mfi::mf1<void, BrowserItem, ModelItem
*>, boost::_bi::list2<boost::_bi::value<BrowserItem *>, boost::arg<1>>>
&, int)')
     (instantiating: 'boost::_bi::bind_t<void, boost::_mfi::mf1<void,
BrowserItem, ModelItem *>,
boost::_bi::list2<boost::_bi::value<BrowserItem *>,
boost::arg<1>>>::accept<boost::signals::detail::bound_objects_visitor>(boost::signals::detail::bound_objects_visitor
&) const')
      (instantiating: 'boost::_bi::list2<boost::_bi::value<BrowserItem
*>,
boost::arg<1>>::accept<boost::signals::detail::bound_objects_visitor>(boost::signals::detail::bound_objects_visitor
&) const')
       (instantiating:
'boost::visit_each<boost::signals::detail::bound_objects_visitor,
BrowserItem *>(boost::signals::detail::bound_objects_visitor &, const
boost::_bi::value<BrowserItem *> &, int)')
BrowserItem.cp line 1750   }
MW Ron - 09 Jan 2004 15:54 GMT
>I am trying to use boost::signals in my application, and I've run into a
>problem.
>
>I try to connect to a signal using a pointer-to-member function set up
>with boost::bind.  The code (greatly simplified for posting) is similar
>to this:

Do a google search on this,  I recall someone with problems with
boos::bind last month or in November.  I don't know if that is the same
problem but it could be.  I think that also had to do with pointers to
member functions.  

I'm sorry I don't have a clear answer,  this sounds familiar but boost
is so complicated I might be confused.

Anyway that is a good place to start looking since no one has answered
with help.

Ron

>extern boost::signal1<void, class ModelItem*> sig;
>
[quoted text clipped - 26 lines]
>  (point of instantiation: 'BrowserItem::BrowserItem(ModelItem *,
>B::OSPtr<OpaqueMenuRef *>)')

Signature

Metrowerks, maker of CodeWarrior   -  "Software Starts Here"  
Ron Liechty - MWRon@metrowerks.com - <http://www.metrowerks.com>

Paul Lalonde - 10 Jan 2004 16:53 GMT
For the benefit of posterity, the problem was caused by having the "ISO
C++ Template Parser" check box turned on in the C/C++ Language prefs
panel.  Turning if off got boost::bind (which is where the real problem
was) to compile correctly.

At a finer granularity, the error disappeared when a "#pragma
parse_func_templ off" was issued.

> Hi All,
>
[quoted text clipped - 72 lines]
> boost::_bi::value<BrowserItem *> &, int)')
> BrowserItem.cp line 1750   }
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.