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.