summaryrefslogtreecommitdiff
path: root/sigc++/signal.h
Commit message (Collapse)AuthorAgeFilesLines
* Add trackable_signal_with_accumulator and trackable_signalKjell Ahlstedt2022-05-311-6/+285
| | | | | | | trackable_signal_with_accumulator derives from trackable. A slot made with trackable_signal_with_accumulator::make_slot() is automatically disconnected when the signal is deleted, as in sigc++2. Fixes #80
* Revert "signal_with_accumulator derives from trackable"Kjell Ahlstedt2022-05-311-22/+10
| | | | | This reverts commit 8fb78907ccf3c4425d23ba1555f365f22d376685. It's not safe. See #80
* signal_with_accumulator derives from trackableKjell Ahlstedt2022-05-301-10/+22
| | | | | | A slot made with signal_with_accumulator::make_slot() is then automatically disconnected when the signal is deleted, as in sigc++2. Fixes #80
* signal::make_slot() docs: Note that signal does not derive from trackableKjell Ahlstedt2022-05-191-0/+6
| | | | | and therefore the made slot must be manually disconnected if the signal is deleted. See #80
* Fix some commentsKjell Ahlstedt2022-04-271-1/+1
|
* docs: Fix links to sigc::slot and sigc::signalKjell Ahlstedt2021-12-291-2/+2
| | | | | | Doxygen creates links to sigc::slot and sigc::signal only if template parameters are included in the documentation. sigc::slot<T_return(T_arg...)>, sigc::signal<T_return(T_arg...)>.
* test_rvalue_ref: Small fixesKjell Ahlstedt2021-06-021-3/+3
| | | | | | | | | | | | * tests/.gitignore: * tests/CMakeLists.txt: * tests/Makefile.am: Add test_rvalue_ref. * tests/test_rvalue_ref.cc: Avoid [-Werror=unused-parameter] when building with warnings=fatal. Some files have been reformated with clang-format in order to make the CI tests happy. Reformated with clang-format 12, but CI uses clang-format 10.
* Revert "test_rvalue_ref: Small fixes"Kjell Ahlstedt2021-06-021-3/+3
| | | | This reverts commit 01652fdbc9f6fc2e72b217c9de8c89c93f95ba7c.
* test_rvalue_ref: Small fixesKjell Ahlstedt2021-06-021-3/+3
| | | | | | | | | | | | * tests/.gitignore: * tests/CMakeLists.txt: * tests/Makefile.am: Add test_rvalue_ref. * tests/test_rvalue_ref.cc: Avoid [-Werror=unused-parameter] when building with warnings=fatal. Some files have also been reformated with clang-format in order to make the CI tests happy. Reformated with clang-format 12, but CI uses clang-format 10.
* Allow slots with rvalue reference parametersSlava Andrejev2021-06-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In code based on Glibmm it's quite common to convert a Glib C structure to a Glib::Object's descendant before passing it as a parameter to a slot. If the slot is not supposed to modify the object, then everything is fine, we can declare the parameter as a const reference and the temporary object will be accurately dealt with by the compiler. However, if the Glib based object is getting modified, the only way to pass it to the slot is to declare it a Glib::RefPtr shared pointer. This creates a lot of unnecessary churn of memory allocations for a simple deal of calling a signal. However, C++ has a specific mean for this particular semantic of passing a temporary object: rvalue reference. For example, somewhere inside Gtkmm might be a declaration: _WRAP_SIGNAL(void sun_rose(const Glib::RefPtr<Gtk::Sun> &new_sun), "sun-rose") Instead its more semantically correct to write: _WRAP_SIGNAL(void sun_rose(Gtk::Sun &&new_sun), "sun-rose") And later somewhere in your code: world->signal_sun_rose().connect([&](auto &&new_sun) { new_sun.shine(); }); This commit makes a couple of simple modifications that allow declaring signals and slots with rvalue reference parameter.
* signal: slot_iterator_buf: Remove T_result default typeMurray Cumming2019-10-291-1/+1
| | | | | This expected a result_type type alias. Luckily, in the few places where we use this, we always specify the type, ignoring the default.
* Reformat code with make formatMurray Cumming2019-10-281-20/+19
|
* slot, signal: Fix the Doxygen documentationKjell Ahlstedt2018-09-101-0/+2
| | | | | | Hide the forward declarations of sigc::slot and sigc::signal from Doxygen. If Doxygen sees the forward declarations, it does not care about what's in the complete class definitions.
* slot, signal: Avoid compiler warnings from function pointer conversionsKjell Ahlstedt2018-08-291-3/+3
| | | | | | | | | | gcc8 -Wextra prints a warning when a single reinterpret_cast is used for conversion between different types of function pointers. The previous fix with a union in sigc::internal::bitwise_equivalent_cast<>() is not standard C++. Rename the function to function_pointer_cast<>(), and use two reinterpret_casts as recommended in gcc's documentation. Fixes #8
* Qualify calls to bitwise_equivalent_cast() with namespace namesKjell Ahlstedt2018-07-171-3/+3
| | | | | Otherwise indirect calls from glibmm, with its own bitwise_equivalent_cast(), can be ambiguous due to ACL (argument-dependent lookup).
* slot, signal: Avoid compiler warnings from function pointer conversionsKjell Ahlstedt2018-07-161-3/+3
| | | | | | | | | gcc8 -Wextra prints a warning when reinterpret_cast is used for conversion between different types of function pointers. Avoid that by adding sigc::internal::bitwise_equivalent_cast<>() with a union with members of the two types of function pointers. Fixes #1
* Revert "slot, signal: Avoid compiler warnings from function pointer conversions"Kjell Ahlstedt2018-07-161-20/+3
| | | | | | This reverts commit c7dbcd5df0e6c260d50fe12dfb2b87a002d91985. This can be done in a better way by keeping the union in a template function.
* slot, signal: Avoid compiler warnings from function pointer conversionsKjell Ahlstedt2018-07-131-3/+20
| | | | | | | | gcc8 -Wextra prints a warning when reinterpret_cast is used for conversion between different types of function pointers. Avoid that by instead using a union with members of the two types of function pointers. Fixes #1
* C++17: Replace some call_*() helpers with std::apply().Murray Cumming2018-04-071-11/+1
|
* signal.h: Correct some strange comment formatting.Murray Cumming2017-07-211-3/+4
|
* Docs: Fix invokation->invocation typos.Murray Cumming2016-04-291-1/+1
|
* copy operations: Name all parameters src.Murray Cumming2016-04-271-5/+5
| | | | To make it more obvious that these are copy operations.
* signal_exec: Rename to signal_exec_holder.Murray Cumming2016-04-241-3/+3
| | | | Because that's what it does. It doesn't execute anything.
* signal_impl: Trying to do the ref-counting with std::shared_ptr.Murray Cumming2016-04-231-3/+3
| | | | Bug #764935
* Connection: Constructor: Take slot_base as reference.Murray Cumming2016-04-221-2/+2
| | | | This constructor existed before, so this avoids an API break.
* signal_emit: Make constructor explicit.Murray Cumming2016-04-211-1/+1
|
* temp_slot_list: Make constructor explicit.Murray Cumming2016-04-211-1/+1
|
* Use temp_slot_list as const.Murray Cumming2016-04-211-3/+3
|
* Fixed missing newline in doxygen comment.Murray Cumming2016-04-211-2/+2
|
* signal_emit: Make a_ private.Murray Cumming2016-04-211-1/+1
|
* signal_emit: Remove some public type aliases.Murray Cumming2016-04-211-2/+2
|
* connection: Take the slot_base directly, without the intermediate slot_iterator.Murray Cumming2016-04-211-74/+9
|
* signal::connect(): Return a sigc::connection.Murray Cumming2016-04-211-3/+9
| | | | Instead of an iterator aliases to a signal<>::connection.
* slot_list: Remove this now-unused class.Murray Cumming2016-04-211-78/+0
|
* Remove unused const_*_iterator.Murray Cumming2016-04-211-70/+0
| | | | And the unused slot_list methods that use it.
* signal: Remove public emitter_type alias.Murray Cumming2016-04-211-1/+1
|
* signal: Rename iterator to connection.Murray Cumming2016-04-211-10/+5
| | | | It is still actually an iterator, but we can change that later.
* Remove now-unused slot_reverse_iterator_buf.Murray Cumming2016-04-211-158/+0
|
* signal: Remove slots().Murray Cumming2016-04-211-29/+5
| | | | | Because it does not seem useful. Also remove the unused extra iterator types and the const slot().
* signal: Remove emit_reverse().Murray Cumming2016-04-211-95/+0
| | | | | It is not used in any tests or examples. Let's see if anybody actually uses it.
* signal: connect(), insert(): Remove unnecessary static_cast<>s.Murray Cumming2016-04-211-4/+4
|
* Correct a doxygen comment.Murray Cumming2016-04-201-1/+1
|
* Update copyright years.Murray Cumming2016-04-201-1/+1
|
* signal: Rename list_ to sig_impl_.Murray Cumming2016-04-191-10/+10
| | | | | Because that's what it is. And avoid the need for a __ prefix on the input parameter.
* signal: Remove __ prefix on tmp variables.Murray Cumming2016-04-191-32/+32
| | | | Leading underscores are reserved in C++.
* Remove _A_ prefixes from method arguments.Murray Cumming2016-04-191-34/+34
| | | | Leading underscores are reserved in C++, and the A is just odd.
* Header guards: Remove leading underscores (and trailing underscores).Murray Cumming2016-04-191-3/+3
| | | | Names with leading underscores are reserved in C++.
* Use typename instead of class for all template parameters.Murray Cumming2016-04-191-12/+12
| | | | | | | | | Apart from template template parameters, which must still be class according to the C++14 standard: http://stackoverflow.com/a/11311432/1123654 though g++ and clang++ actually already supporting using typename instead by implementing N4051: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4051.html
* Revert "Always use typename rather than class for template types."Murray Cumming2016-04-191-12/+12
| | | | | | | | This reverts commit 180353986d101e367c26b3199c44c7b2e4c1e681. Because I misread https://stackoverflow.com/questions/213121/use-class-or-typename-for-template-parameters class is _still_ needed for template template parameters in C++14, though g++ and clang++ seem to support it anyway.
* Always use typename rather than class for template types.Murray Cumming2016-04-191-12/+12
| | | | | | | For consistency. As of C++14 class is not necessary even for template template parameters. We can change those few uses back to class if any (otherwise compliant-enough) compiler actually needs it. See http://stackoverflow.com/a/11311432/1123654