- 500 名前:デフォルトの名無しさん mailto:sage [2012/04/16(月) 16:33:08.30 ]
- intとstringを含む構造体をわかり易い名前(#define以外)で
参照できるようにして、更に定数として中身を変更できないように したいです。 以下のコードではエラーが出ました。 よろしくお願いします。 #include <map> #include <string> #include <iostream> #include <vector> int main() { using namespace std; struct Hoge{ const string a; const string b; const int c; const int d; } ; Hoge hoge = {"a","b",1,2}; map<string,Hoge> piyo; piyo.insert( map<string, Hoge>::value_type( "test", hoge ) ); cout << piyo["test"].c; int i; cin >> i; return 0; }
|

|