Boost signals2 automatic connection management and changing the mutex type of a signal

后端 未结 1 1119
忘了有多久
忘了有多久 2021-01-16 09:50

I am trying to use automatic connection management and changing the mutex type of a signal for a template function.

The following code compiles and executes fine usi

相关标签:
1条回答
  • 2021-01-16 10:11

    I examined the code, but couldn't find the immediate cause of the error. By once assigning &Simple::proxy to equivalent variable as the following, VC compiled the code somehow:

    template < typename F, typename ST, typename A1 >
    boost::signals2::connection connectAutoMgmt( F f, ST st, A1 a1 ) {
        void (Simple::*p)( F, ST, int ) = &Simple::proxy;
        return sig.connect( sig_type::slot_type( p, .... ).track( st ) );
    }
    
    void init() {
        ....
        void (Simple::*p)(
          void(Simple::*)(int), boost::shared_ptr< Simple >, int ) =
          &Simple::proxy;
    
        boost::signals2::connection c2 = sig.connect(
            sig_type::slot_type( p, .... ).track( s2 ) );    
        ....
    

    However, I cannot figure out why the above changes have an effect. Honestly I suspect VC's bug at the moment... Anyway, hope this helps.

    0 讨论(0)
提交回复
热议问题