79544090

Date: 2025-03-30 01:19:33
Score: 1
Natty:
Report link

SOLVED (using a combination of 3CxEZiVlQ and Useless's answers:

#include <cstdlib>

template <typename E>
class ABag {
    int used;
    E* data;
    public:
    E& operator[](size_t idx) { // from  3CxEZiVlQ

        if (idx >= used)
            {exit(-1);}
        return data[idx];
    }

};

template <typename Key, typename E>
class KVpair {};

template <typename Key, typename E>
class BDictionary {
 public:
  bool find(const Key& k, E& rtnval) const {
    for (size_t cur_pos = 0; cur_pos < 0; cur_pos++) {
      KVpair<Key, E> temp = (*dictionary)[cur_pos]; // from Useless
    }
    return false;
  }

 private:
  ABag<KVpair<Key, E>> *dictionary;
};

int main() {
  BDictionary<int, int> d;
  int rv = 0;
  d.find(0, rv);
}

Thanks! Really appreciate the help.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user30104669