Boost logo

Boost Users :

From: Allen Gooch (allen.gooch_at_[hidden])
Date: 2006-08-04 15:08:56


I have a quick question regarding connecting a bound member function.
In the doc_view example application signals are defined as requiring a
function taking a bool and returning nothing.

class Document
{
public:
     typedef boost::signal< void (bool) > signal_t;
     // ...

     void append(const char* s)
     {
         m_text += s;
         m_sig(true);
     }
     // ...
};

The View abstract base class requires concrete bases to provide a
concrete implementation of the refresh() member function matching the
slot signature required.

class View
{
public:
     virtual void refresh(bool) const = 0;
     // ...
};

Here's my problem. If I change the signal to take no args using the
preferred or portable syntax I get compilation errors:

class Document
{
public:
     typedef boost::signal< void () > signal_t;
     // ...

     void append(const char* s)
     {
         m_text += s;
         m_sig(true);
     }
     // ...
};

class View
{
public:
     virtual void refresh() const = 0;
     // ...
};

Compilation output (msvc-7.1):

Compiling...
SignalTest.cpp
c:\Boost\include\boost-1_33_1\boost\bind.hpp(63) : error C2825:
'F::result_type': cannot form a qualified name
         c:\Boost\include\boost-1_33_1\boost\bind\bind_template.hpp(15)
: see reference to class template instantiation
'boost::_bi::result_traits<R,F>' being compiled
         with
         [
             R=boost::_bi::unspecified,
             F=void (__thiscall View::* )(void) const
         ]
         c:\development\SignalTest\SignalTest.cpp(49) : see reference to
class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
         with
         [
             R=boost::_bi::unspecified,
             F=void (__thiscall View::* )(void) const,
             L=boost::_bi::list2<boost::_bi::list_av_2<View
*,boost::arg<1>>::B1,boost::_bi::list_av_2<View *,boost::arg<1>>::B2>
         ]
c:\Boost\include\boost-1_33_1\boost\bind.hpp(63) : error C2039:
'result_type' : is not a member of 'operator``global namespace'''
c:\Boost\include\boost-1_33_1\boost\bind.hpp(63) : error C2146: syntax
error : missing ';' before identifier 'type'
c:\Boost\include\boost-1_33_1\boost\bind.hpp(63) : error C2955:
'boost::_bi::type' : use of class template requires template argument list
         c:\Boost\include\boost-1_33_1\boost\bind.hpp(112) : see
declaration of 'boost::_bi::type'
c:\Boost\include\boost-1_33_1\boost\bind.hpp(63) : fatal error C1903:
unable to recover from previous error(s); stopping compilation

Observed with boost_1_33_1 release on cygwin/gcc-3.4.4 and msvc-7.1
platforms. Any ideas?

Many thanks in advance,
-allen


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