У меня был такой код:
Код: Выделить всё
#include
#include
template
requires(std::derived_from)
class MyBaseClass
{
// Has some base properties
public:
bool operator==(const CLAZZ other) const
{
return true; // For sure this is more complex
}
bool operator==(const std::optional other) const
{
return true; // For sure this is more complex
}
};
class MyDerivatedClass : public MyBaseClass
{
// More properties added
};
Потому что из этого я использую только текущий класс вместо последнего класса, несмотря на то, что это приводит к риску того, что случайно существуют два производных класса, которые не должны иметь совместимого сравнения (меры безопасности на самом деле не станут проблемой для моего варианта использования). Наверное).
Код: Выделить всё
#include
#include
template
requires(std::derived_from)
class MyBaseClass
{
// Has some base properties
public:
bool operator==(const MyBaseClass other) const
{
return true; // For sure this is more complex
}
bool operator==(const std::optional other) const
{
return true; // For sure this is more complex
}
};
Затем я попробовал использовать определение пересылки, которое сообщает мне, что предложение require несовместимо:
Код: Выделить всё
template
class MyBaseClass;
Подробнее здесь: https://stackoverflow.com/questions/783 ... mentations