In C++20, concepts were added, and so were constrained algorithms such as std::ranges::for_each
.
Why is the range-based for loop error message has plain errors like:
begin
andend
are not declared in a scope.
Why not just:
- a given expression doesn't satisfy
std::ranges::range
It will still confuse some of the beginners and maybe just create a specific concept name (hidden) so that they will get what is missing.
In structured binding compiler error, the message is very clear.
Is it the compiler's responsibility to address this problem or the standard committee?