Код: Выделить всё
#include
template class CombineI;
template class CombineI {
public:
template
requires(i == I)
const T &get() const {
return data;
}
private:
T data;
};
template
class CombineI : public CombineI {
public:
using CombineI::get; // use the parent get member
template
requires(i == I)
const T &get() const {
return data;
}
private:
T data;
};
template class Combine : public CombineI {};
int main() {
Combine c;
c.get(); // works
c.get(); // works
c.get(); // does not compile, why? "No matching member function for call to 'get'"
}
< /code>
Я не понимаю, почему функция участника самого старого родителя в иерархии можно назвать c.get (); // работает Код: Выделить всё
No matching member function for call to 'get'может кто -нибудь это объяснить?
Подробнее здесь: https://stackoverflow.com/questions/796 ... onstraints
Мобильная версия