good day.
suppose i have:
how can i make CList::hasKey(c onst Key &key) const ?
thanks for clarifications.
suppose i have:
Code:
class Key; class Value; class CList : public boost::enable_shared_from_this<CList> { std::map<Key, Value> _data; std::shared_ptr<CList> _pParentPtr; public: //... bool hasKey(const Key &key) const; std::shared_ptr<CList> getParent() const{ return _pParentPtr; } }; bool CList::hasKey(const Key &key) { boost::shared_ptr<CList> pCurList(shared_from_this()); //! bool res = false; do{ res = _data.find(key) != data.end(); pCurList = pCurList->getParent(); } while (!res && pCurList); return res; }
thanks for clarifications.
Comment