Re: [sigc] std::function<> and std::bind() in libsigc++
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] std::function<> and std::bind() in libsigc++
- Date: Mon, 28 Oct 2013 16:34:15 +0100
2013-10-28 00:21, Chris Vine skrev:
On Sun, 27 Oct 2013 13:10:25 +0100
Kjell Ahlstedt <kjell ahlstedt bredband net> wrote:
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).
How about, at the beginning of this block of documentation,
substituting "A Slot can be constructed from any function or function
object," for "A Slot can be constructed from any function,".
You could then probably omit the reference to a std::function object,
and perhaps substitute an example using a lambda expression.
*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?
I think this is fine but on reflection I might omit the reference to
std::function entirely. I doubt whether many people would think of
passing a std::function object to sigc::slot. The preceding text
states that sigc::slot can be constructed from arbitrary function
objects. If someone were to construct a sigc::slot object from a
std::function object, they probably either know what they are doing or
really want to do it for some other reason (type erasure of the
underlying function object may already have taken place and there may be
nothing the user can do about it).
I think you are doing a great job with this documentation by the way
(and with glibmm/gtkmm).
Chris
I have pushed a new commit,
https://git.gnome.org/browse/libsigc++2/commit/?id=62617fc598292925117e63e372b138caebbca1f0
I have changed approximately (not exactly) as you suggested.
Kjell
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]