Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for callbacks with no argument #56

Merged
merged 6 commits into from
Mar 9, 2022
Merged

Conversation

pjueon
Copy link
Owner

@pjueon pjueon commented Mar 6, 2022

related to #53

Changed:

  • Add support for callbacks with no argument

@pjueon
Copy link
Owner Author

pjueon commented Mar 6, 2022

Need to fix:

  • If the callback object can be called not only with a const std::string& argument and also without any argument, the method without any argument will be called in the current implementation.
// if you use this object as a callback, 
struct Foo
{
    void operator()();           // this method will be used as a callback function in the current implemantation
    void operator()(const std::string& channel);
};
  • I think it would be more natural to use the method with a const std::string& argument.
  • It should be stated in the document that which method will be used in this scenario.

@pjueon pjueon added the enhancement New feature or request label Mar 6, 2022
- If the callback object can be called
not only with one string argument,
but also without any argument,
select the method with one string argument.
- add static assertions for readability.
- update README
- remove the argument name that are not used.
@pjueon
Copy link
Owner Author

pjueon commented Mar 9, 2022

Need to fix:

  • If the callback object can be called not only with a const std::string& argument and also without any argument, the method without any argument will be called in the current implementation.
// if you use this object as a callback, 
struct Foo
{
    void operator()();           // this method will be used as a callback function in the current implemantation
    void operator()(const std::string& channel);
};
  • I think it would be more natural to use the method with a const std::string& argument.
  • It should be stated in the document that which method will be used in this scenario.

Fixed the issue.

@pjueon pjueon merged commit 232ac8d into master Mar 9, 2022
@pjueon pjueon deleted the no_arg_callback branch March 9, 2022 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant