how to document function templates with `requires` clauses and `static_assert`s?

48 Views Asked by At

If there were a std::frobnicate function template in the C++ standard, it might be specifed as follows:

template <class T>
void frobnicate(T t);

Requires: widget<T> is true

Mandates: sprocket<T> is false

The "Requires" says that this overload is only considered for types that satisfy the widget concept. It is equivalent to constraining the function with requires widget<T>.

The "Mandates" says that if you call frobnicate with a sprocket, the program will be ill-formed. It is equivalent to a static_assert(!sprocket<T>) in the body of the function.

I would like to be able to draw this distinction in my Doxygen comments. Sadly there does not appear to be any @requires or @mandates Doxygen special commands. Are there other features I can (ab)use to achieve this?

0

There are 0 best solutions below