One of the (so very many) unfortunate design flaws of C++ is that it is basically impossible to separate implementation from interface when using template metaprogramming.
All over my library I have things like:
template <typename Ma, typename Mb>
typename boost::enable_if_c<
detail::IsMatrix<Ma>::val and detail::IsMatrix<Mb>::val and
detail::MatrixDimensionCheck<Ma,Mb>::isStaticMatch,
bool>::type
operator==(const Ma &a, const Mb &b) {
return detail::matrixEqual(a,b);
}
If this is unreadable, I don't blame you. Most of this mess is simply defining the return type to be bool
if the arguments are matrices and match dimension, and be undefined if they are something else (thus relying on SFINAE to prevent this operator from hiding other important things).
Since the guts of what is essentially a static type-checking function are now embedded into the signature of my ordinary C++ function, these implementation guts will appear in the generated documentation.
I don't want the user to have to read this. All they need to know is that this function returns a bool
(which is almost impossible to tell by reading the above). In the docs, I can explain succinctly, in plain English, that this operator accepts only matrices.
Is there a way to persuade Doxygen to render that type mess as bool
? (I'm assuming there is more or less no way to clean this up in the code directly, but ideas are welcome if you can think of something).