mirror of
https://github.com/Nekrolm/ubbook.git
synced 2025-12-18 13:14:41 +03:00
не компилируется пример кода
из дочернего класса нельзя просто так достучаться до методов родительского, если родительский класс параметризован шаблоном. только через `this->`
This commit is contained in:
@@ -62,8 +62,8 @@ class MapWrapper : private std::map<K, V> {
|
|||||||
public:
|
public:
|
||||||
template <class Predicate>
|
template <class Predicate>
|
||||||
const std::pair<K, V>& find_if_or_throw(Predicate p) const {
|
const std::pair<K, V>& find_if_or_throw(Predicate p) const {
|
||||||
auto item = std::find_if(cbegin(), cend(), p);
|
auto item = std::find_if(this->cbegin(), this->cend(), p);
|
||||||
if (item == cend()) {
|
if (item == this->cend()) {
|
||||||
throw std::runtime_error("not found");
|
throw std::runtime_error("not found");
|
||||||
}
|
}
|
||||||
return *item;
|
return *item;
|
||||||
|
|||||||
Reference in New Issue
Block a user