
16 Nov
2024
16 Nov
'24
11:33 a.m.
That's correct, that's also what it was originally. But the error messages were horrendous. By creating a base class you get good error messages (purely virtual because method X is missing) and the compiler is still compelled to devirtualize by the way it's used. And because it's effectively unused, you can disable it.
Couldn't you achieve a similar effect (scoped to C++20 and later) by conditionally using concepts? In a way similar to what Asio does to diagnose completion tokens (i.e. BOOST_ASIO_COMPLETION_TOKEN_FOR).
Yes, but I wanted to provide a solution for C++14.