Re: [sigc] std::function<> and std::bind() in libsigc++




2013-10-26 12:54, Chris Vine skrev:
It follows that I think the text "It is often possible to replace sigc::slot<> by the C++11 class std::function<>, for instance ..." is a little misleading. It is not replacing it, it is wrapping it by implicit conversion. But as I say, better to encourage people to pass the lambda _expression_ (or whatever) directly.
You are right. if the slot will be connected to a signal, and that's what you usually do with slots.
I can change the description. How about this?

slot_base.h, Slots
sigc::slot<> is similar to std::function<>. If you're going to assign the resulting functor to a sigc::slot or connect it to a sigc::signal, it's better not to use std::function. It would become un unnecessary extra wrapper.

Delete the new example with m_Dialog.signal_response().connect(fn).

slot.h, sigc::slot<>
sigc::slot<> is similar to std::function<>. If you're going to assign the resulting functor to a sigc::slot or connect it to a sigc::signal, it's better not to use std::function. It would become un unnecessary extra wrapper.

Can you come up with better descriptions?


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