Re: [sigc] How does std::function<> work with libsigc++



On Fri, 2013-07-26 at 08:06 -0400, Paul Davis wrote:



On Fri, Jul 26, 2013 at 7:03 AM, Murray Cumming <murrayc murrayc com>
wrote:
        C+11 has std::function<> which is a bit like sigc::slot,
        though C++11
        doesn't have anything like sigc::signal<>. I played with that
        here:
        http://www.murrayc.com/permalink/2013/07/08/c-in-glom-shared_ptr-and-slotsfunctions/
        
        I've noticed that std::function<> works with libsigc++, as in
        the code
        below, but I wonder why it works. Can anyone explain?
        


I have used boost::function with sigc++, and my guess when it worked
is that sigc++::slot (like boost slots and other similar libraries,
including our own that we use for ardour) only requires an
operator()() (i.e. functor invocation), which std::function also
provides. last time i looked, sigc::slot is heavily templated, so any
class that provides the required (minimal) API will work.


what made you expect that it would *not* work?

Because the signals' connect() function seems to take specifically
sigc::slot:
https://developer.gnome.org/libsigc
++/unstable/classsigc_1_1signal7.html#adc55ac9b0f935fd87a67904022e03cb2

But I haven't looked at it enough detail.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]