I have a concept that check if the operator< is available to be used on 2 types:
template<class T, class _T>
concept LsOp = requires (T r, _T l)
{
{ r < l } -> bool;
};
And I wan't to use it as something like:
template<class T>
class MyClass
{
public:
template<LsOp _T>
[[nodiscard]] bool operator<(const _T &_val) const
{
return m_value < _val;
}
private:
T m_value;
};
But I don't know what should I change in the syntax to make it work.
For starters, symbols that begin with an underscore and an uppercase letter are reserved for the C++ library, and should not be used.
Secondly, the following compiles with gcc 13: