私はPHPから来ています
$um['Im a string'][1] = 3;
最初のキーが文字列、2番目のキーが整数、値が整数である2D連想配列の場合。私はc++でも同じことをしようとしています。これが私の試みです:
// experiment.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <unordered_map>
#include <vector>
#include <string>
using std::vector;
using std::string;
using std::unordered_map;
int _tmain(int argc, _TCHAR* argv[])
{
unordered_map <string,vector<int,int>> um;
um["Im a string"][1] = 3;
printf("Out: %d", um["Im a string"][1]);
return 0;
}
明らかにそれは正しい構文ではありません。