mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
wpiutil: Signal: make operator() const (#1721)
This enables const-ness in uv::Handle ReportError() and Invoke() as well.
This commit is contained in:
@@ -235,7 +235,7 @@ class Handle : public std::enable_shared_from_this<Handle> {
|
||||
* Report an error.
|
||||
* @param err Error code
|
||||
*/
|
||||
void ReportError(int err) { error(Error(err)); }
|
||||
void ReportError(int err) const { error(Error(err)); }
|
||||
|
||||
protected:
|
||||
explicit Handle(uv_handle_t* uv_handle) : m_uv_handle{uv_handle} {
|
||||
@@ -250,7 +250,7 @@ class Handle : public std::enable_shared_from_this<Handle> {
|
||||
static void DefaultFreeBuf(Buffer& buf);
|
||||
|
||||
template <typename F, typename... Args>
|
||||
bool Invoke(F&& f, Args&&... args) {
|
||||
bool Invoke(F&& f, Args&&... args) const {
|
||||
auto err = std::forward<F>(f)(std::forward<Args>(args)...);
|
||||
if (err < 0) ReportError(err);
|
||||
return err == 0;
|
||||
|
||||
Reference in New Issue
Block a user