如何在c ++中打印字典?这是我正在运行的代码,我无法使用printDicionary方法

这是我正在运行的代码,我无法使用printDicionary方法。 我不确定如何使用我创建的矢量,我想知道如何以这种方式打印所有元素:

[0]:

[1] :( 1501,“adiós”),(301,“ nuevo”)

[2]:

[3] :( 23,“ perro”)

[5] :( 15,“ hola”)

[9] :( 9,“ gato”)

    #include <iostream>
    #include <vector>
using namespace std;

template <class K, class V>
class KeyPair{
    public:
    K key;
    V value;

    KeyPair(){
        key=NULL;
        value=NULL;
    }

    KeyPair(K key, V val){
        this->key=key;
        this->value=val;
    }
};

template <class K, class V>
class Dictionary{
    public:
    vector<KeyPair<K,V> > *dict;
    int positions;

    Dictionary(){
        positions=10;
        dict=new vector<KeyPair<K,V> >[positions];
    }

    Dictionary(int pos){
        positions=pos;
        dict=new vector<KeyPair<K,V> >[positions];
    }

    void insert(K key, V value){
        KeyPair<K,V> kp(key, value);
        int hash=key%positions;
        for(int i=0; i<dict[hash].size(); i++){
            if(dict[hash][i].key==key){
                cout<<"llave ya existente"<<endl;
                return;
            }
        }
        dict[hash].push_back(kp);
        //dict//arreglo de vectores keypair
        //dict[hash]//vector de keypair

    }

    V checkAtKey(K key){
        int hash=key%positions;
        for(int i=0; i<dict[hash].size(); i++){
            if(dict[hash][i].key==key){
                return dict[hash][i].value;
            }
        }
        return NULL;
    }

    void printDictionary(){ 
这是我创建方法的地方
        for(int i=0; i<dict[i].size(); i++){

        cout << dict.key <<endl; 
我不确定这是否是我打电话给字典的方式
        cout << dict.value <<endl;
        return;


            }

        }




};

int main(){
    Dictionary<int, string> a;
    a.insert(5, "perro");
    a.insert(4, "gato");
  Dictionary<int, string> b;
  b.insert(15, "lombriz");

  b.printDictionary();
}