1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

The use of bind in Ticker.h is prone to type inference failure (#6129)

* std::bind has issues with type inference, use lambdas whereever possible.

* Fix indentation.

* More descriptive placeholder name in lambda expression

* Use formal argument names for remaining currying placeholders
This commit is contained in:
Dirk O. Kaar
2019-05-25 20:12:48 +02:00
committed by david gauchard
parent 09f6b87ef5
commit 2d9253e46c
2 changed files with 21 additions and 19 deletions

View File

@ -43,7 +43,7 @@ public:
void attach_scheduled(float seconds, callback_function_t callback)
{
attach(seconds,std::bind(schedule_function, callback));
attach(seconds, [callback]() { schedule_function(callback); });
}
void attach(float seconds, callback_function_t callback)
@ -54,7 +54,7 @@ public:
void attach_ms_scheduled(uint32_t milliseconds, callback_function_t callback)
{
attach_ms(milliseconds, std::bind(schedule_function, callback));
attach_ms(milliseconds, [callback]() { schedule_function(callback); });
}
void attach_ms(uint32_t milliseconds, callback_function_t callback)
@ -84,7 +84,7 @@ public:
void once_scheduled(float seconds, callback_function_t callback)
{
once(seconds, std::bind(schedule_function, callback));
once(seconds, [callback]() { schedule_function(callback); });
}
void once(float seconds, callback_function_t callback)
@ -95,7 +95,7 @@ public:
void once_ms_scheduled(uint32_t milliseconds, callback_function_t callback)
{
once_ms(milliseconds, std::bind(schedule_function, callback));
once_ms(milliseconds, [callback]() { schedule_function(callback); });
}
void once_ms(uint32_t milliseconds, callback_function_t callback)