Problem countalp
User justin271828
Submission Time 2023-06-14 13:36:59
Score 0
Max Time N/A
Max Memory N/A

Compile Error

countalp.cpp: In function ‘int main()’:
countalp.cpp:10:3: error: ambiguous overload for ‘operator[]’ (operand types are ‘std::map<char, int>’ and ‘const char [2]’)
10 | M["a"] = 0;
| ^
In file included from /usr/include/c++/9/map:61,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
from countalp.cpp:1:
/usr/include/c++/9/bits/stl_map.h:490:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = char; _Tp = int; _Compare = std::less<char>; _Alloc = std::allocator<std::pair<const char, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = char]’ <near match>
490 | operator[](const key_type& __k)
| ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:490:7: note: conversion of argum