#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
// your code goes here
std::map<std::string, std::string> asinPathTypeMap;
string inPathName = "abcd";
// asinPathTypeMap.insert(std::pair<std::string, std::string>(inPathName, "string"));
asinPathTypeMap.insert(inPathName, "string");
cout<<asinPathTypeMap[inPathName];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c3RyaW5nPgoKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCXN0ZDo6bWFwPHN0ZDo6c3RyaW5nLCBzdGQ6OnN0cmluZz4gYXNpblBhdGhUeXBlTWFwOwoJc3RyaW5nIGluUGF0aE5hbWUgPSAiYWJjZCI7Ci8vCSAgYXNpblBhdGhUeXBlTWFwLmluc2VydChzdGQ6OnBhaXI8c3RkOjpzdHJpbmcsIHN0ZDo6c3RyaW5nPihpblBhdGhOYW1lLCAic3RyaW5nIikpOwphc2luUGF0aFR5cGVNYXAuaW5zZXJ0KGluUGF0aE5hbWUsICJzdHJpbmciKTsKCSAgY291dDw8YXNpblBhdGhUeXBlTWFwW2luUGF0aE5hbWVdOwoKCXJldHVybiAwOwp9
prog.cpp: In function 'int main()':
prog.cpp:13:44: error: no matching function for call to 'std::map<std::basic_string<char>, std::basic_string<char> >::insert(std::string&, const char [7])'
asinPathTypeMap.insert(inPathName, "string");
^
In file included from /usr/include/c++/5/map:61:0,
from prog.cpp:2:
/usr/include/c++/5/bits/stl_map.h:612:7: note: candidate: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, std::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, std::basic_string<char> >]
insert(const value_type& __x)
^
/usr/include/c++/5/bits/stl_map.h:612:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/5/bits/stl_map.h:620:9: note: candidate: template<class _Pair, class> std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >]
insert(_Pair&& __x)
^
/usr/include/c++/5/bits/stl_map.h:620:9: note: template argument deduction/substitution failed:
prog.cpp:13:44: note: candidate expects 1 argument, 2 provided
asinPathTypeMap.insert(inPathName, "string");
^
In file included from /usr/include/c++/5/map:61:0,
from prog.cpp:2:
/usr/include/c++/5/bits/stl_map.h:633:7: note: candidate: void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >]
insert(std::initializer_list<value_type> __list)
^
/usr/include/c++/5/bits/stl_map.h:633:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/5/bits/stl_map.h:662:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, std::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, std::basic_string<char> > >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, std::basic_string<char> >]
insert(const_iterator __position, const value_type& __x)
^
/usr/include/c++/5/bits/stl_map.h:662:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::map<std::basic_string<char>, std::basic_string<char> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, std::basic_string<char> > >}'
/usr/include/c++/5/bits/stl_map.h:673:9: note: candidate: template<class _Pair, class> std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >]
insert(const_iterator __position, _Pair&& __x)
^
/usr/include/c++/5/bits/stl_map.h:673:9: note: template argument deduction/substitution failed:
prog.cpp:13:44: note: cannot convert 'inPathName' (type 'std::string {aka std::basic_string<char>}') to type 'std::map<std::basic_string<char>, std::basic_string<char> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, std::basic_string<char> > >}'
asinPathTypeMap.insert(inPathName, "string");
^
In file included from /usr/include/c++/5/map:61:0,
from prog.cpp:2:
/usr/include/c++/5/bits/stl_map.h:688:9: note: candidate: template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::basic_string<char>; _Tp = std::basic_string<char>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > >]
insert(_InputIterator __first, _InputIterator __last)
^
/usr/include/c++/5/bits/stl_map.h:688:9: note: template argument deduction/substitution failed:
prog.cpp:13:44: note: deduced conflicting types for parameter '_InputIterator' ('std::basic_string<char>' and 'const char*')
asinPathTypeMap.insert(inPathName, "string");
^