Commit b832c273 authored by Dominik Charousset's avatar Dominik Charousset

Add static_assert for better compiler errors

parent 6894e710
......@@ -489,6 +489,8 @@ disposable observable<T>::subscribe(ignore_t) {
template <class T>
template <class OnNext>
disposable observable<T>::for_each(OnNext on_next) {
static_assert(std::is_invocable_v<OnNext, const T&>,
"for_each: the on_next function must accept a 'const T&'");
return subscribe(make_observer(std::move(on_next)));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment