(no title)
suls | 5 years ago
The error messages produced by g++ for anything template related are a really difficult hurdle to overcome as a beginner. I am sure once you mastered it, it does make sense -- but right now it's a source of frustration for me.
nikki93|5 years ago
pjmlp|5 years ago
For the time being, any library writer can improve their own error messages using a mix of constexpr if, static_assert and enable_if.
nikki93|5 years ago
Also, to clarify on the original point, in this case it doesn't require that much template trickery. Most attributes could be handled as `.foo(Foos::BAR_1)` to set HTML attribute `foo="bar_1"` for example and have things still be 'type safe' on the C++ side. I just pass strings through right now to have a catch-all API, then I could go back on it after some real use and see what styles come in practice.
The only template it happens to use right now is the usual `template<typename F>` with `F &&f` to let you pass an inlineable lambda. I could use `static_assert` as you say, with `std::is_invocable_v`, and offer a nicer error message when that doesn't match.