Skip to content
This repository was archived by the owner on Aug 19, 2021. It is now read-only.

Add member-function overloads for event functions #19

Merged
merged 1 commit into from
Sep 28, 2016

Conversation

geky
Copy link
Contributor

@geky geky commented Sep 28, 2016

Added the following overloads:

event(T *,                R (T::*)(A...),                A...);
event(const T *,          R (T::*)(A...) const,          A...);
event(volatile T *,       R (T::*)(A...) volatile,       A...);
event(const volatile T *, R (T::*)(A...) const volatile, A...);

To the following functions:

EventQueue::call
EventQueue::call_in
EventQueue::call_every
EventQueue::event
Event::Event

This does allow the traditional form of mbed callbacks:

Event<void(int)> event(&object, &Object::method, arg1);
event->post(arg2);

But also adds a significant number of overloads due to the cv attributes. It may be worth it in this situation to conform to the user's expectations.

@pan-, @bogdanm thoughts?

Added the following overloads:
- event(T *,                R (T::*)(A...),                A...)
- event(const T *,          R (T::*)(A...) const,          A...)
- event(volatile T *,       R (T::*)(A...) volatile,       A...)
- event(const volatile T *, R (T::*)(A...) const volatile, A...)

To the following functions:
- EventQueue::call
- EventQueue::call_in
- EventQueue::call_every
- EventQueue::event
- Event::Event

This does allow the traditional form of mbed callbacks:

    Event<void(int)> event(&object, &Object::method, arg1);
    event->post(arg2);

But also adds a significant number of overloads due to the cv
attributes. It may be worth it in this situation to conform to the
user's expectations.
@geky geky force-pushed the event-member-functions branch from bb0faeb to 2595a65 Compare September 28, 2016 05:03
@bogdanm
Copy link

bogdanm commented Sep 28, 2016

👍

@geky geky merged commit 5effcbc into master Sep 28, 2016
@geky geky deleted the event-member-functions branch September 28, 2016 19:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants