std::pairの値を持つマップがあります。
イテレータを設定しようとすると、コンパイラは次のように文句を言いますが、理由がわかりません。
src / DBConnector.cpp:メンバー関数内'int DBConnector :: createGenericInsert(std :: string、std :: map <std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、 std :: pair <int、std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>>、std :: less <std :: basic_string <char、std :: char_traits <char >、std :: allocator <char >>>、std :: allocator <std :: pair <const std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、std :: pair <int、std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>> >> >> >>、std :: string&)':src / DBConnector.cpp:354:エラー:いいえ'l_oIterEnd = p_mapValues.std :: map <_Key、_Tp、_Compare、_Alloc>::の'operator='に一致_Key = std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、_ Tp = std :: pair <int、std :: basic_string <char、std ::char_traits<charで終了>、std :: allocator <char >>>、_ Compare = std :: less <std :: basic_string <char、std :: char_traits <char>、std :: allocator <char >>>、_ Alloc = std :: allocator <std :: pair <const std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、std :: pair <int、std :: basic_string <char、std :: char_traits < char>、std :: allocator <char>> >>>'/usr/include/c++/4.4/bits/stl_map.h:251:注:候補は次のとおりです:std :: map <_Key、_Tp、_Compare、_Alloc> &std :: map <_Key、_Tp、_Compare、_Alloc> :: operator =(const std :: map <_Key、_Tp、_Compare、_Alloc>&)[with _Key = std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、_Tp = std :: pair <int、std :: basic_string <char、std :: char_traits < char>、std :: allocator <char >>>、_ Compare = std :: less <std :: basic_string <char、std :: char_traits <char>、std :: allocator <char >>>、_ Alloc = std :: allocator <std :: pair <const std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>>、std :: pair <int、std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>> >> >>]basic_string <char、std :: char_traits <char>、std :: allocator <char>>>、_ Alloc = std :: allocator <std :: pair <const std :: basic_string <char、std :: char_traits <char>、 std :: allocator <char>>、std :: pair <int、std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>> >> >>]basic_string <char、std :: char_traits <char>、std :: allocator <char>>>、_ Alloc = std :: allocator <std :: pair <const std :: basic_string <char、std :: char_traits <char>、 std :: allocator <char>>、std :: pair <int、std :: basic_string <char、std :: char_traits <char>、std :: allocator <char>> >> >>]
私の機能はそのままです:
int DBConnector::createGenericInsert ( std::string p_sTable , std::map<std::string , std::pair<int,std::string> > p_mapValues , std::string & po_sInsert ) {
std::map<std::string,std::pair<int,std::string> > l_oIter;
std::map<std::string,std::pair<int,std::string> > l_oIterEnd;
std::string s_Fieldnames;
l_oIterEnd = p_mapValues.end(); // This is line 354
l_oIter = p_mapValues.begin();
s_Fieldnames += l_oIter.first();
...
}
ここでの問題は何ですか?マップにstd::pairを含めることはできますか?(さらに、マップにさまざまなタイプを保持するキーを含めることはできますか?)