не компилируется пример кода

из дочернего класса нельзя просто так достучаться до методов родительского, если родительский класс параметризован шаблоном. только через `this->`
This commit is contained in:
Yegor Bychin
2021-09-29 00:29:07 +03:00
committed by GitHub
parent f5593d756f
commit ee88fbafd6

View File

@@ -62,8 +62,8 @@ class MapWrapper : private std::map<K, V> {
public:
template <class Predicate>
const std::pair<K, V>& find_if_or_throw(Predicate p) const {
auto item = std::find_if(cbegin(), cend(), p);
if (item == cend()) {
auto item = std::find_if(this->cbegin(), this->cend(), p);
if (item == this->cend()) {
throw std::runtime_error("not found");
}
return *item;