3 ms·
The bit between the < and > I find hard to understand. In C++ behaviours are named, like in some C++ code coroutines there is a template that looks like: temp
by samsquire 3y ago
The bit between the < and > I find hard to understand.
In C++ behaviours are named, like in some C++ code coroutines there is a template that looks like:
template <is_task task_t>
The is_task looks like an if statement.
- foota 3y agoMy impression is that coroutines aren't super stable today, but what you're seeing there is a C++20 "concept", essentially, a way to restrict the types accepted by a template. E.g., the is_task part is a concept that requires the template parameter type task_t to meet some criteria. Normal template code looks like: template <typename T> Where you can also choose to use the class keyword instead of typename. C++20 isn't very widely used though, so this isn't something you're likely to run into in anything other than cutting edge code. If you want you can read about them here: https://en.cppreference.com/w/cpp/language/constraints https://en.cppreference.com/w/cpp/language/constraints but you're probably better not using concepts at least at first. In general, https://en.cppreference.com/ https://en.cppreference.com/ is a very high quality source for learning, although it's very dry as well.