I try to define a concept with a requires expression which checks some member function existence on the type.
The problem I run into is, that a single concept has to be plugged in for the return type check without any preceding bool operations like "not". This forces me to also write concepts for the inverse if needed, which is not really handy.
Is there something I am missing or another good way to do it?
Simple example:
template <typename T>
concept IsReference = std::is_reference_v<T>;
template <typename T>
concept HasSomeFunction = requires (T t) {
{t.func()} -> IsReference; /* this is ok */
{t.anotherFunc()} -> (not IsReference); /* this is not ok */
};
Try this