Słownik z trzema typami zmiennych

0

Jak moge zrobić słownik z trzema typami zmiennych? Musi być on dostępny w całym programie. Próbowałem coś takiego:

#include <iostream>
#include <map>
#include <utility>
#include <string>
using namespace std;

map<pair<int, string>, int> mapa;

void show()
{
    mapa.insert(make_pair(434543, "tekst"), 54656);
    cout << mapa.first;
}

int main()
{
    show()

    return 0;
}

ale wyskakuje mi błąd
error: no matching function for call to 'std::map<std::pair<int, std::__cxx11::basic_string<char> >, int>::insert(std::pair<int, const char*>, int)' mapa.insert(make_pair(434543, "tekst"), 54656);

1

Bo nie masz funkcji do insertowania czegoś takiego jak tam podałeś. Spróbuj użyć make_pair dwa razy (zagnieździć jedno w drugim).
Jakiś przykład:
http://stackoverflow.com/questions/2392093/searching-and-inserting-in-a-map-with-3-elements-in-c

1
map<pair<int, string>, int> map;
map[{0, "Hello"}] = 1;
map.insert({{0, "World"}, 2});
1
#include <iostream>
#include <map>
#include <utility>
#include <string>
using namespace std;

map<pair<int, string>, int> mapa;

void show()
{
	mapa.insert(make_pair(make_pair<int, string>(2,"Helol"), 54656));
	for (auto it : mapa)
	{
		cout<<it.first.first<<" "<<it.first.second<<" "<<it.second;
	}
}

int main()
{
	show();

	cin.ignore();
	return 0;
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1